//------------------------------------------------------------------------ void CPlant::Update(float frameTime, uint32 frameId) { FUNCTION_PROFILER( GetISystem(), PROFILE_GAME ); bool requireUpdate=false; CActor *pActor=m_pWeapon->GetOwnerActor(); if (m_plantTimer>0.0f) { m_plantTimer -= frameTime; if (m_plantTimer<=0.0f) { m_plantTimer = 0.0f; if (m_planting) { Vec3 pos; Vec3 dir(FORWARD_DIRECTION); Vec3 vel(0,0,0); // placed weapons have already stored the position etc to place at. if(m_plantparams.place_on_ground) Plant(m_plantPos, m_plantDir, m_plantVel); else if(GetPlantingParameters(pos, dir, vel)) Plant(pos, dir, vel); m_plantPos.zero(); m_plantDir.zero(); m_plantVel.zero(); requireUpdate = true; } } } if (requireUpdate) m_pWeapon->RequireUpdate(eIUS_FireMode); }
bool BaseAI::startTurn() { static bool initialized = false; int count = 0; count = getPlantCount(); plants.clear(); plants.resize(count); for(int i = 0; i < count; i++) { plants[i] = Plant(getPlant(i)); } if(!initialized) { initialized = true; init(); } return run(); }
//------------------------------------------------------------------------ void CPlant::NetShootEx(const Vec3 &pos, const Vec3 &dir, const Vec3 &vel, const Vec3 &hit, float extra, int ph) { Plant(pos, dir, vel, true, ph); }