Exemplo n.º 1
0
        internal AIUpdate(GameObject gameObject, AIUpdateModuleData moduleData)
        {
            GameObject  = gameObject;
            _moduleData = moduleData;

            TargetPoints = new List <Vector3>();

            _locomotors = new Dictionary <LocomotorSetType, Locomotor>();

            SetLocomotor(LocomotorSetType.Normal);
        }
Exemplo n.º 2
0
        internal AIUpdate(GameObject gameObject, AIUpdateModuleData moduleData)
        {
            GameObject  = gameObject;
            _moduleData = moduleData;

            TargetPoints = new List <Vector3>();

            _locomotors = new Dictionary <LocomotorSetType, Locomotor>();

            SetLocomotor(LocomotorSetType.Normal);

            if (_moduleData.Turret != null)
            {
                _turretAIUpdate = _moduleData.Turret.CreateTurretAIUpdate(GameObject);
            }
        }
Exemplo n.º 3
0
        internal AIUpdate(GameObject gameObject, AIUpdateModuleData moduleData)
        {
            GameObject  = gameObject;
            _moduleData = moduleData;

            TargetPoints = new List <Vector3>();

            _stateMachine = new AIStateMachine();

            _locomotorSet            = new LocomotorSet(gameObject);
            _currentLocomotorSetType = (LocomotorSetType)(-1);

            SetLocomotor(LocomotorSetType.Normal);

            if (_moduleData.Turret != null)
            {
                _turretAIUpdate = _moduleData.Turret.CreateTurretAIUpdate(GameObject);
            }
        }
Exemplo n.º 4
0
 internal AIUpdate(AIUpdateModuleData moduleData)
 {
     _moduleData = moduleData;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Converts a Generals-style WeaponSet to a C&C3-style WeaponSetUpdate.
        /// </summary>
        internal WeaponSetUpdateModuleData ToWeaponSetUpdate(AIUpdateModuleData aiUpdate)
        {
            // TODO: Need to move this up a level, to allow for multiple WeaponSets.
            var result = new WeaponSetUpdateModuleData();

            var slotsToProcess = new SortedSet <WeaponSlot>(Slots.Keys);

            var id = 1u;

            void SetWeaponSlotData(WeaponSlotHardpointData weaponSlot)
            {
                // TODO
                weaponSlot.WeaponChoiceCriteria = WeaponChoiceCriteria.PreferMostDamage;
            }

            void AddWeapon(WeaponSlotHardpointData weaponSlot, WeaponSlot slot)
            {
                if (!Slots.TryGetValue(slot, out var weaponSetSlot))
                {
                    return;
                }

                // TODO: PreferredAgainst
                // TODO: OnlyAgainst
                // TODO: AutoChooseSources

                weaponSlot.Weapons.Add(new WeaponSlotWeaponData
                {
                    Ordering = slot,
                    Template = weaponSetSlot.Weapon,
                });

                slotsToProcess.Remove(slot);
            }

            void AddWeaponSlotTurret(TurretAIUpdateModuleData turretAIData)
            {
                var weaponSlot = new WeaponSlotTurretData
                {
                    ID             = id++,
                    TurretSettings = turretAIData,
                };

                SetWeaponSlotData(weaponSlot);

                foreach (var controlledWeaponSlot in turretAIData.ControlledWeaponSlots.GetSetBits())
                {
                    AddWeapon(weaponSlot, controlledWeaponSlot);
                }

                if (weaponSlot.Weapons.Count == 0)
                {
                    return;
                }

                result.WeaponSlotTurrets.Add(weaponSlot);
            }

            if (aiUpdate?.Turret != null)
            {
                AddWeaponSlotTurret(aiUpdate.Turret);
            }

            if (aiUpdate?.AltTurret != null)
            {
                AddWeaponSlotTurret(aiUpdate.AltTurret);
            }

            // If there were any weapon slots that weren't controlled by a turret,
            // create a WeaponSlotHardpoint for them.
            if (slotsToProcess.Count > 0)
            {
                var weaponSlot = new WeaponSlotHardpointData
                {
                    ID = id++
                };

                SetWeaponSlotData(weaponSlot);

                while (slotsToProcess.Count > 0)
                {
                    var slot = slotsToProcess.Min;
                    AddWeapon(weaponSlot, slot);
                    slotsToProcess.Remove(slot);
                }

                result.WeaponSlotHardpoints.Add(weaponSlot);
            }

            return(result);
        }
Exemplo n.º 6
0
 internal AssaultTransportAIUpdate(GameObject gameObject, AIUpdateModuleData moduleData)
     : base(gameObject, moduleData)
 {
 }