Beispiel #1
0
        /// <summary>
        /// Calculates the speed of an individual extreme gear for a specific formation.
        /// </summary>
        /// <param name="extremeGear">The extreme gear for which to calculate the gear speed for.</param>
        /// <param name="formationType">The type of the character to calculate the gear speed for.</param>
        /// <param name="characterLevel">The current level of the character from 0-2.</param>
        /// <param name="rawSpeed">Raw speed in game units.</param>
        /// <returns>Speed in UI/HUD units.</returns>
        public static float GetGearSpeed(ExtremeGear *extremeGear, FormationTypes formationType, int characterLevel, out float rawSpeed)
        {
            var typeStats      = &Player.TypeStats.Pointer[(int)formationType];
            var typeLevelStats = CharacterTypeStats.GetLevelStats(typeStats, characterLevel);

            var speedMultiplier = (1 + extremeGear->SpeedHandlingMultiplier);
            var totalSpeed      = typeLevelStats->SpeedCap3 + extremeGear->AdditiveSpeed;

            rawSpeed = totalSpeed * speedMultiplier;

            // Apply Speed Multiplier
            return(SpeedToSpeedometerRatio * rawSpeed);
        }
        /// <summary>
        /// create new squadron
        /// </summary>
        /// <param name="Colonel">unit that will be formation leader</param>
        /// <param name="game">game</param>
        /// <param name="FormationType">formation type to set</param>
        public Squadron(UnitPilot Colonel,IGame game,FormationTypes FormationType)
        {
            isOrdered = true;
            state = States.Nothing;
            neededState = States.Nothing;
            stateChangingTimer = new Timer(0.5f);
            behaviour = Behaviours.Waiting;
            reSortingTimer = new Timer(2);

            List<UnitPilot>  pilots = new List<UnitPilot>();
            switch (FormationType)
            {
                case FormationTypes.Line: formation = new LineFormation(Colonel, pilots, 100, AngleClass.pi * 0.0f); break;
                case FormationTypes.Bar: formation = new BarFormation(Colonel, pilots, 5, 200, 150, 0); break;
                case FormationTypes.Stagger: formation = new StaggerFormation(Colonel, pilots, 90, 120); break;
            }
        }
        /// <summary>
        /// Checks if the given set of flags contains a specific type.
        /// </summary>
        /// <param name="flags">The flags to check.</param>
        /// <param name="type">The type to check for.</param>
        public static bool ContainsType(this FormationTypesFlags flags, FormationTypes type)
        {
            var flag = 1 << (int)type;

            return(((int)flags & flag) != 0);
        }
        /// <summary>
        /// sets a new formation type
        /// </summary>
        /// <param name="NewType">new formation type</param>
        public void SetFormationType(FormationTypes NewType)
        {
            isOrdered = NewType!= FormationTypes.Swarm;
            state = States.Nothing;
            neededState = States.Nothing;
            behaviour = Behaviours.Waiting;

            UnitPilot Colonel = formation.Leader;
            List<UnitPilot> pilots =new List<UnitPilot>();
            foreach (UnitPilot pilot in formation)
            {                pilots.Add(pilot);            }
            switch (NewType)
            {
                case FormationTypes.Line: formation = new LineFormation(Colonel, pilots, 100, AngleClass.pi * 0.0f); break;
                case FormationTypes.Bar: formation = new BarFormation(Colonel, pilots, 5, 200, 150, 0); break;
                case FormationTypes.Stagger: formation = new StaggerFormation(Colonel, pilots, 90, 120); break;
                case FormationTypes.Swarm: formation = new SwarmFormation(pilots); break;
                //case FormationTypes.Custom: formation = new CustomFormation(pilots,0); break;
            }
        }
 public void SetFormationType(int formationTypeNum)
 {
     Formation = (FormationTypes)formationTypeNum;
 }
 void Start()
 {
     // Init values
     SelectedUnits = new List <GameObject>();
     Formation     = FormationTypes.Health;
 }