Example #1
0
        public SpecialAttack DeploySpecialAttack(SpecialAttackTypeVO specialAttackType, TeamType teamType, Vector3 worldPosition, bool playerDeployed)
        {
            this.boardPosition = Units.WorldToBoardIntPosition(worldPosition);
            if ((specialAttackType.IsDropship || specialAttackType.HasDropoff) && teamType == TeamType.Attacker)
            {
                if (Service.ShieldController.IsTargetCellUnderShield(worldPosition))
                {
                    Service.EventManager.SendEvent(EventId.TroopPlacedInsideShieldError, this.boardPosition);
                    return(null);
                }
                if (!Service.TroopController.FindValidDropShipTroopPlacementCell(this.boardPosition, teamType, 1, out this.boardPosition))
                {
                    Service.EventManager.SendEvent(EventId.TroopPlacedInsideBuildingError, this.boardPosition);
                    return(null);
                }
            }
            BoardCell cellAt = Service.BoardController.Board.GetCellAt(this.boardPosition.x, this.boardPosition.z);

            if (cellAt == null)
            {
                Service.EventManager.SendEvent(EventId.TroopNotPlacedInvalidArea, this.boardPosition);
                return(null);
            }
            base.EnsureBattlePlayState();
            Vector3       targetWorldPos = Units.BoardToWorldVec(this.boardPosition);
            SpecialAttack specialAttack  = new SpecialAttack(specialAttackType, teamType, targetWorldPos, cellAt.X, cellAt.Z, playerDeployed);

            specialAttack.TargetShield = Service.ShieldController.GetActiveShieldAffectingBoardPos(specialAttack.TargetBoardX, specialAttack.TargetBoardZ);
            this.specialAttacksDeployed.Enqueue(specialAttack);
            Service.EventManager.SendEvent(EventId.SpecialAttackSpawned, specialAttack);
            return(specialAttack);
        }
        private void PlaceSquadFlag(FactionType faction)
        {
            string assetName;

            if (faction == FactionType.Empire)
            {
                assetName = GameConstants.SQUAD_TROOP_DEPLOY_FLAG_EMPIRE_ASSET;
            }
            else
            {
                assetName = GameConstants.SQUAD_TROOP_DEPLOY_FLAG_REBEL_ASSET;
            }
            IntPosition position = new IntPosition(this.spawnPosition.x - 1, this.spawnPosition.z);
            Vector3     worldPos = Units.BoardToWorldVec(position);

            Service.Get <FXManager>().CreateFXAtPosition(assetName, worldPos, Quaternion.AngleAxis(-90f, Vector3.up));
        }