Example #1
0
        public Turret(long _uniqueId, Vector3 _position, Quaternion _rotation, String _modelFile, Vector3 _fireConeNormal, float _fireConeAngle, Battleship _parent)
            : base(_uniqueId, _position, _rotation, _modelFile)
        {
            Health = MAX_HEALTH;

            fireConeNormalVector = _fireConeNormal;
            fireConeNormalVector.Normalize(); // Just in case
            fireConeAngle = MathHelper.ToRadians(_fireConeAngle);

            parent = _parent;

            assignedPhase = nextAssignedPhase;
            switch (nextAssignedPhase)
            {
                case activationPhase.first: nextAssignedPhase = activationPhase.second; break;
                case activationPhase.second: nextAssignedPhase = activationPhase.third; break;
                case activationPhase.third: nextAssignedPhase = activationPhase.first; break;
            }

            MAX_SLERP = SLERP_SPEED;

            Rotation = AdjustRotationNoLimit(Vector3.Backward, fireConeNormalVector, Vector3.Up);

            fireTimer = FIRE_TIMER;

            detectionSphere = new CollisionSphere(_position, FIRE_RANGE);
            detectionSphere.Active = true;
        }
Example #2
0
 public static void updateGlobalTurretTimer(float deltaTime)
 {
     timer -= deltaTime;
     //if (timer <= 0)
     {
         switch (currentPhase)
         {
             case activationPhase.first: currentPhase = activationPhase.second; break;
             case activationPhase.second: currentPhase = activationPhase.third; break;
             case activationPhase.third: currentPhase = activationPhase.first; break;
         }
     }
     //else { }
 }