コード例 #1
0
        public void AddUnit(Players playerId, Vector2 position, UnitTypes name, float rot = 0f, int health = 0)
        {
            IUnit unit;

            switch (name)
            {
            case UnitTypes.Arrow:
                unit = new Arrow(playerId, position, rot, mGridSize, position);
                break;

            case UnitTypes.Swordsman:
                unit = new Swordsman(playerId, position, rot, mGridSize);
                break;

            case UnitTypes.Cavalry:
                unit = new Cavalry(playerId, position, rot, mGridSize);
                break;

            case UnitTypes.Hero:
                var hero = new Hero(playerId, position, rot, mGridSize, mContent);
                unit = hero;
                HeroesByPlayer[playerId] = hero;
                break;

            case UnitTypes.Bowman:
                unit = new Bowman(playerId, position, rot, mGridSize);
                break;

            case UnitTypes.BatteringRam:
                unit = new BatteringRam(playerId, position, rot, mGridSize);
                break;

            default:
                return;
            }

            if (unit is IDamageableUnit damageableUnit && health != 0)
            {
                damageableUnit.Health = health;
            }

            if (!UnitsByPlayer.ContainsKey(playerId))
            {
                UnitsByPlayer.Add(playerId, new List <IUnit>());
            }

            UnitsByPlayer[playerId].Add(unit);
            if (unit.UnitType == UnitTypes.Hero || unit.UnitType == UnitTypes.Swordsman || unit.UnitType == UnitTypes.Cavalry ||
                unit.UnitType == UnitTypes.BatteringRam || unit.UnitType == UnitTypes.Bowman)
            {
                StatisticsByPlayer[playerId]["CreateTroops"] += 1;
            }
            if (!UnitsByModel.ContainsKey(unit.ModelType))
            {
                UnitsByModel.Add(unit.ModelType, new List <IUnit>());
            }

            UnitsByModel[unit.ModelType].Add(unit);
        }
        public override void AssignParameters(SpawnerEntityMissionHelper _spawnerMissionHelper)
        {
            base.AssignParameters(_spawnerMissionHelper);
            _spawnerMissionHelper.SpawnedEntity.GetFirstScriptOfType <DestructableComponent>().MaxHitPoint = 12000f;
            BatteringRam firstScriptOfType = _spawnerMissionHelper.SpawnedEntity.GetFirstScriptOfType <BatteringRam>();

            firstScriptOfType.MaxSpeed *= 1f;
            firstScriptOfType.MinSpeed *= 1f;
        }
コード例 #3
0
        public override void AssignParameters(SpawnerEntityMissionHelper _spawnerMissionHelper)
        {
            BatteringRam firstScriptOfType = _spawnerMissionHelper.SpawnedEntity.GetFirstScriptOfType <BatteringRam>();

            firstScriptOfType.AddOnDeployTag    = this.AddOnDeployTag;
            firstScriptOfType.RemoveOnDeployTag = this.RemoveOnDeployTag;
            firstScriptOfType.MaxSpeed         *= this.SpeedModifierFactor;
            firstScriptOfType.MinSpeed         *= this.SpeedModifierFactor;
            firstScriptOfType.AssignParametersFromSpawner(this.GateTag, this.SideTag, this.BridgeNavMeshID_1, this.BridgeNavMeshID_2, this.DitchNavMeshID_1, this.DitchNavMeshID_2, this.GroundToBridgeNavMeshID_1, this.GroundToBridgeNavMeshID_2, this.PathEntityName);
        }
コード例 #4
0
ファイル: FixBlueGear.cs プロジェクト: phasic22/FixSiegeAI
 public static bool Prefix(ref OrderType __result, BatteringRam __instance, BattleSideEnum side)
 {
     if (side == BattleSideEnum.Defender)
     {
         __result = OrderType.AttackEntity;
         return(false);
     }
     if (__instance.HasCompletedAction() | __instance.IsDestroyed | __instance.IsDeactivated | __instance.IsDisabled)
     {
         __result = OrderType.None; return(false);
     }
     __result = OrderType.Use;
     return(false);
 }
コード例 #5
0
        /// <summary>
        /// Must be implemented. Otherwise there are no textures available to draw them on the plane
        /// </summary>
        public sealed override void LoadTextures()
        {
            this.beginTex   = this.game.Content.Load <Texture2D>("Textures/BatteringRam/battering_ram_begin");
            this.halfTex    = this.game.Content.Load <Texture2D>("Textures/BatteringRam/battering_ram_halfway");
            this.readyTex   = this.game.Content.Load <Texture2D>("Textures/BatteringRam/battering_ram_ready");
            this.curTexture = this.beginTex;

            //In your own class do the same thing, as it's done below. Use the same order, otherwise some funny bugs shall appear
            this.batteringRamRangeMenu = null;
            this.game.RegisterGameComponent <BatteringRamRangeMenu>(out this.batteringRamRangeMenu, false, false);
            this.menu = this.batteringRamRangeMenu;
            this.menu.SetParent(this);
            this.batteringRamRangeMenu.ConvertParent();
            this.humansParent.GetListOfPersons(ref this.listOfPersons);

            this.batteringRamObject = (from target in this.listOfPersons
                                       where target.Role == CellState.BatteringRam
                                       select target).ElementAt(0) as BatteringRam;
            this.batteringRamObject.BatteringRamRangeBuilt  = true;
            this.batteringRamObject.BatteringRamRangeObject = this;
            this.batteringRamRangeMenu.SetBatteringRamObject(ref this.batteringRamObject);

            base.LoadTextures();
        }
コード例 #6
0
 /// <summary>
 /// Should be done from the Loadtextures method of the parent class
 /// Otherwise the NullReference exception will be thrown
 /// </summary>
 public void ConvertParent()
 {
     this.batteringRamObject = this.parent as BatteringRam;
 }
コード例 #7
0
 public BatteringRamAI(BatteringRam batteringRam)
     : base((UsableMachine)batteringRam)
 {
 }
コード例 #8
0
 public void SetBatteringRamObject(ref BatteringRam batteringRamObject)
 {
     this.batteringRamObject = batteringRamObject;
 }
 public SetBatteringRamHasArrivedAtTarget(BatteringRam batteringRam) => this.BatteringRam = batteringRam;