Exemple #1
0
        private SpecialAttack DeploySpecialAttack()
        {
            if (Service.SimTimeEngine.IsPaused())
            {
                return(null);
            }
            BattleController battleController = Service.BattleController;

            if (battleController.BattleEndProcessing)
            {
                return(null);
            }
            if (battleController.GetPlayerDeployableSpecialAttackCount(this.currentSpecialAttackType.Uid) == 0)
            {
                Service.EventManager.SendEvent(EventId.TroopNotPlacedInvalidTroop, this.currentWorldPosition);
                return(null);
            }
            if (this.currentSpecialAttackType != null)
            {
                TeamType teamType = TeamType.Attacker;
                if (battleController.GetCurrentBattle().Type == BattleType.PveDefend)
                {
                    teamType = TeamType.Defender;
                }
                SpecialAttack specialAttack = Service.SpecialAttackController.DeploySpecialAttack(this.currentSpecialAttackType, teamType, this.currentWorldPosition, true);
                if (specialAttack != null)
                {
                    IntPosition boardPosition = Units.WorldToBoardIntPosition(this.currentWorldPosition);
                    battleController.OnSpecialAttackDeployed(this.currentSpecialAttackType.Uid, teamType, boardPosition);
                    Service.EventManager.SendEvent(EventId.SpecialAttackDeployed, specialAttack);
                    return(specialAttack);
                }
            }
            return(null);
        }
        public SmartEntity SpawnTroop(TroopTypeVO troopType, TeamType teamType, IntPosition boardPosition, TroopSpawnMode spawnMode, bool sendPlacedEvent, bool forceAllow)
        {
            Entity             spawnBuilding = null;
            BoardCell <Entity> boardCell     = null;

            if (!this.FinalizeSafeBoardPosition(troopType, ref spawnBuilding, ref boardPosition, ref boardCell, teamType, spawnMode, forceAllow))
            {
                return(null);
            }
            SmartEntity smartEntity = Service.Get <EntityFactory>().CreateTroopEntity(troopType, teamType, boardPosition, spawnBuilding, spawnMode, true, true);

            if (smartEntity == null)
            {
                return(null);
            }
            BoardItemComponent boardItemComp = smartEntity.BoardItemComp;
            BoardItem <Entity> boardItem     = boardItemComp.BoardItem;

            if (Service.Get <BoardController>().Board.AddChild(boardItem, boardCell.X, boardCell.Z, null, false, !forceAllow && troopType.Type != TroopType.Champion) == null)
            {
                return(null);
            }
            Service.Get <EntityController>().AddEntity(smartEntity);
            Service.Get <TroopAbilityController>().OnTroopSpawned(smartEntity);
            if (troopType.Type != TroopType.Champion || teamType == TeamType.Attacker)
            {
                base.EnsureBattlePlayState();
            }
            if (sendPlacedEvent)
            {
                Service.Get <EventManager>().SendEvent(EventId.TroopPlacedOnBoard, smartEntity);
            }
            return(smartEntity);
        }
Exemple #3
0
        /// <summary>
        /// Execute stuff when a slot is clicked
        /// </summary>
        /// <param name="sender">Component who sent the event</param>
        /// <param name="e">Event</param>
        public void OnSlotClicked(object sender, EventArgs e)
        {
            Slot        slot     = sender as Slot;
            IntPosition position = slot.GetPosition();

            PlayMove(position);
        }
Exemple #4
0
        private void DeployTroopGroup(int index, TroopTypeVO troop, DefenseTroopGroup group)
        {
            int degrees = group.Direction;

            if (group.Quantity > 1)
            {
                degrees = group.Direction + group.Spread * index / (group.Quantity - 1) - group.Spread / 2;
            }
            int locX = 0;
            int locZ = 0;

            DefensiveBattleController.GetBoardEdge(degrees, group.Range, out locX, out locZ);
            IntPosition nearestValidBoardPosition = this.GetNearestValidBoardPosition(locX, locZ);
            bool        sendPlacedEvent           = index == 0;
            Entity      entity = this.troopController.SpawnTroop(troop, TeamType.Attacker, nearestValidBoardPosition, TroopSpawnMode.Unleashed, sendPlacedEvent);

            if (entity != null)
            {
                if (!troop.IsHealer)
                {
                    this.waves[this.currentWaveIndex].Troops.Add(entity);
                }
                Service.BattleController.OnTroopDeployed(troop.Uid, TeamType.Attacker, nearestValidBoardPosition);
                Service.EventManager.SendEvent(EventId.TroopDeployed, entity);
            }
        }
        public void DeploySquadTroops(IntPosition boardPos)
        {
            this.Reset();
            this.spawnPosition = boardPos;
            IDataController dataController = Service.Get <IDataController>();

            this.spawnQueue = new List <TroopTypeVO>();
            List <SquadDonatedTroop> troops = Service.Get <SquadController>().StateManager.Troops;

            if (troops != null)
            {
                int i     = 0;
                int count = troops.Count;
                while (i < count)
                {
                    TroopTypeVO item        = dataController.Get <TroopTypeVO>(troops[i].TroopUid);
                    int         j           = 0;
                    int         totalAmount = troops[i].GetTotalAmount();
                    while (j < totalAmount)
                    {
                        this.spawnQueue.Add(item);
                        j++;
                    }
                    i++;
                }
            }
            this.OnDeploy();
        }
Exemple #6
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 SmartEntity DeployChampion(TroopTypeVO troopType)
        {
            if (Service.Get <SimTimeEngine>().IsPaused())
            {
                return(null);
            }
            BattleController battleController = Service.Get <BattleController>();

            if (battleController.BattleEndProcessing)
            {
                return(null);
            }
            if (battleController.GetPlayerDeployableChampionCount(troopType.Uid) == 0)
            {
                Service.Get <EventManager>().SendEvent(EventId.TroopNotPlacedInvalidTroop, this.currentWorldPosition);
                return(null);
            }
            TeamType teamType = TeamType.Attacker;

            if (battleController.GetCurrentBattle().Type == BattleType.PveDefend)
            {
                teamType = TeamType.Defender;
            }
            IntPosition boardPosition = Units.WorldToBoardIntDeployPosition(this.currentWorldPosition);
            SmartEntity smartEntity   = Service.Get <TroopController>().SpawnChampion(troopType, teamType, boardPosition);

            if (smartEntity != null)
            {
                base.PlaySpawnEffect(smartEntity);
                battleController.OnChampionDeployed(troopType.Uid, teamType, boardPosition);
                Service.Get <EventManager>().SendEvent(EventId.ChampionDeployed, smartEntity);
            }
            return(smartEntity);
        }
Exemple #8
0
 /// <summary>
 /// Simple alpha-beta algorithm
 /// </summary>
 /// <param name="nodeBoard">A particular game state</param>
 /// <param name="depth">The maximum tree depth</param>
 /// <param name="parentValue"></param>
 /// <param name="maximizingPlayer"></param>
 /// <returns></returns>
 private Tuple <int, IntPosition> AlphaBeta(AIBoard nodeBoard, int depth, int parentValue, bool maximizingPlayer)
 {
     if (depth == 0 || nodeBoard.IsTerminal())
     {
         return(new Tuple <int, IntPosition>(nodeBoard.CurrentPlayerData.NumberOfPawns, new IntPosition(-1, -1)));
     }
     else
     {
         int         optVal         = maximizingPlayer ? -int.MaxValue : int.MaxValue;
         IntPosition optOp          = new IntPosition(-1, -1);
         var         childPositions = nodeBoard.GetAllPossibleMoves();
         foreach (var child in childPositions)
         {
             var returnVal = AlphaBeta(PosToBoard(child, nodeBoard), depth - 1, optVal, !maximizingPlayer);
             int minOrMax  = maximizingPlayer ? 1 : -1;
             if (returnVal.Item1 * minOrMax > optVal * minOrMax)
             {
                 optVal = returnVal.Item1;
                 optOp  = child;
                 if (optVal * minOrMax > parentValue * minOrMax)
                 {
                     break;
                 }
             }
         }
         return(new Tuple <int, IntPosition>(optVal, optOp));
     }
 }
Exemple #9
0
        private SmartEntity CreateDefensiveChampionEntityForBattle(TroopTypeVO championType, SmartEntity building)
        {
            TransformComponent transformComp = building.TransformComp;
            IntPosition        boardPosition = new IntPosition(transformComp.CenterGridX(), transformComp.CenterGridZ());

            return(Service.Get <TroopController>().SpawnChampion(championType, TeamType.Defender, boardPosition));
        }
Exemple #10
0
 public TroopSpawnData(TroopTypeVO troop, IntPosition position, TroopSpawnMode mode, int amount)
 {
     this.TroopType     = troop;
     this.BoardPosition = position;
     this.SpawnMode     = mode;
     this.Amount        = amount;
 }
Exemple #11
0
        // ----------------------------------------------------------------------------------------------------
        // -- Construtors
        // ----------------------------------------------------------------------------------------------------

        public TerminalRenderer(int charsX, int charsY)
        {
            sizeX = charsX;
            sizeY = charsY;
            charactersPositions       = new Vector3[sizeY, sizeX];
            charactersBuffer          = new TerminalCharacter[sizeY, sizeX];
            negativeCharactersIndices = new IntPosition[sizeY * sizeX];
            // load resources
            theme              = new TangoTheme( );
            cursor             = new TerminalCursor(this);
            defaultMaterial    = ReadMaterial("VARP/DebugDraw/GLFontZOff");
            defaultFont        = ReadFont("VARP/DebugDraw/GLFont");
            backgroundMaterial = ReadMaterial("VARP/DebugDraw/GLlineZOff");
            // get font's information
            CharacterInfo space;

            defaultFont.GetCharacterInfo(' ', out space);
            lineHeight          = defaultFont.lineHeight;
            charWidth           = space.advance;
            textRectangle       = new Rect(0, 0, charWidth * sizeX, lineHeight * sizeY);
            backgroundRectangle = new Rect(textRectangle.min - backgrounOffset, textRectangle.max + backgrounOffset);
            // fill buffer coordiates
            for (var y = 0; y < sizeY; y++)
            {
                for (var x = 0; x < sizeX; x++)
                {
                    charactersPositions[y, x] = new Vector3((float)x * charWidth, (float)y * lineHeight, 0);
                }
            }
            // clear screen
            Clear( );
        }
Exemple #12
0
        public void RenderScreen( )
        {
            GL.invertCulling = true;
            GL.PushMatrix( );
            GL.LoadPixelMatrix( );
            GL.Begin(GL.QUADS);
            // Render background
            backgroundMaterial.SetPass(0);
            if (isBackgroundVisible)
            {
                GL.Color(backgroundColor);
                GL.Vertex(new Vector3(backgroundRectangle.min.x, backgroundRectangle.max.y, 0));
                GL.Vertex(new Vector3(backgroundRectangle.max.x, backgroundRectangle.max.y, 0));
                GL.Vertex(new Vector3(backgroundRectangle.max.x, backgroundRectangle.min.y, 0));
                GL.Vertex(new Vector3(backgroundRectangle.min.x, backgroundRectangle.min.y, 0));
            }
            // Render text buffer
            defaultMaterial.SetPass(0);
            var negativeCharsCount = 0;

            for (var y = 0; y < sizeY; y++)
            {
                for (var x = 0; x < sizeX; x++)
                {
                    if (charactersBuffer[y, x].isNegative)
                    {
                        negativeCharactersIndices[negativeCharsCount++] = new IntPosition(x, y);
                    }
                    RenderCharacter(charactersPositions[y, x], charactersBuffer[y, x].character, charactersBuffer[y, x].foreground);
                }
            }
            // Render negative characters
            backgroundMaterial.SetPass(0);
            GL.Color(theme.selectionColor);
            for (var i = 0; i < negativeCharsCount; i++)
            {
                var xyidx = negativeCharactersIndices[i];
                var min   = charactersPositions[xyidx.y, xyidx.x];
                var max   = GetCursorSize( );
                GL.Vertex(new Vector3(min.x, max.y, 0));
                GL.Vertex(new Vector3(max.x, max.y, 0));
                GL.Vertex(new Vector3(max.x, min.y, 0));
                GL.Vertex(new Vector3(min.x, min.y, 0));
            }
            // Render cursor
            if (isCursorVisible)
            {
                var min = GetCursorCoordinates( );
                var max = min + GetCursorSize( );
                GL.Color(theme.cursorColor);
                GL.Vertex(new Vector3(min.x, max.y, 0));
                GL.Vertex(new Vector3(max.x, max.y, 0));
                GL.Vertex(new Vector3(max.x, min.y, 0));
                GL.Vertex(new Vector3(min.x, min.y, 0));
            }
            GL.End( );
            GL.PopMatrix( );
            GL.invertCulling = false;
        }
        private void SquadTroopPlacedActionCallback(uint id, object cookie)
        {
            SquadTroopPlacedAction   squadTroopPlacedAction = cookie as SquadTroopPlacedAction;
            IntPosition              boardPos = new IntPosition(squadTroopPlacedAction.BoardX, squadTroopPlacedAction.BoardZ);
            Dictionary <string, int> attackerGuildTroopsAvailable = this.battleController.GetCurrentBattle().AttackerGuildTroopsAvailable;

            Service.Get <SquadTroopAttackController>().DeploySquadTroops(boardPos, attackerGuildTroopsAvailable);
        }
Exemple #14
0
        void OnTextChanged(object sender, System.EventArgs e)
        {
            Position currentPosition = new IntPosition(richTextBox1.SelectionStart);
            Position start           = GetPrevWordPosition(currentPosition);
            Position end             = controller.GetNextPosition(currentPosition);

            FindErrors(start, end);
        }
 public override EatResponse OnRelease()
 {
     if (base.IsNotDraggedAndReleasingOwnPress() && !Service.Get <SquadTroopAttackController>().Spawning&& !Service.Get <SimTimeEngine>().IsPaused() && !Service.Get <BattleController>().BattleEndProcessing&& Service.Get <BattleController>().CanPlayerDeploySquadTroops())
     {
         IntPosition boardPos = Units.WorldToBoardIntDeployPosition(this.currentWorldPosition);
         Service.Get <SquadTroopAttackController>().DeploySquadTroops(boardPos);
     }
     return(EatResponse.NotEaten);
 }
Exemple #16
0
        public override void Perform()
        {
            Service.BotRunner.Performing = true;
            Service.BotRunner.Log("Deploying Squad Troops", new object[0]);
            IntPosition boardPos = new IntPosition(22, 22);

            Service.SquadTroopAttackController.DeploySquadTroops(boardPos);
            Service.ViewTimerManager.CreateViewTimer(1f, false, new TimerDelegate(this.DelayComplete), null);
        }
Exemple #17
0
        private void OnSpawnDropshipTroopsTimer(uint id, object cookie)
        {
            SpecialAttack specialAttack = cookie as SpecialAttack;
            IntPosition   spawnPosition = Units.WorldToBoardIntPosition(specialAttack.TargetWorldPos);

            if (Service.GameStateMachine.CurrentState is BattlePlayState || Service.GameStateMachine.CurrentState is BattlePlaybackState)
            {
                this.DeployDropShipTroops(spawnPosition, specialAttack.VO.LinkedUnit, specialAttack.VO.UnitCount, specialAttack.TeamType);
            }
        }
        public SmartEntity CreateChampionEntity(TroopTypeVO championType, IntPosition position)
        {
            SmartEntity smartEntity = this.CreateWalkerBaseEntity(position, championType.SizeX, championType.SizeY);

            smartEntity.TransformComp.Rotation = 90f;
            smartEntity.Add(new ChampionComponent(championType));
            smartEntity.Add(new WalkerComponent(championType.AssetName, championType));
            Service.Get <EntityViewManager>().LoadEntityAsset(smartEntity);
            return(smartEntity);
        }
        private void ChampionDeployedActionCallback(uint id, object cookie)
        {
            ChampionDeployedAction championDeployedAction = cookie as ChampionDeployedAction;
            IDataController        dataController         = Service.Get <IDataController>();
            TroopTypeVO            troopTypeVO            = dataController.Get <TroopTypeVO>(championDeployedAction.TroopUid);
            IntPosition            boardPosition          = new IntPosition(championDeployedAction.BoardX, championDeployedAction.BoardZ);

            Service.Get <TroopController>().SpawnChampion(troopTypeVO, championDeployedAction.TeamType, boardPosition);
            this.battleController.OnChampionDeployed(troopTypeVO.Uid, championDeployedAction.TeamType, boardPosition);
        }
        private void TroopPlacedActionCallback(uint id, object cookie)
        {
            TroopPlacedAction troopPlacedAction = cookie as TroopPlacedAction;
            IDataController   dataController    = Service.Get <IDataController>();
            TroopTypeVO       troopTypeVO       = dataController.Get <TroopTypeVO>(troopPlacedAction.TroopId);
            IntPosition       boardPosition     = new IntPosition(troopPlacedAction.BoardX, troopPlacedAction.BoardZ);

            Service.Get <TroopController>().SpawnTroop(troopTypeVO, troopPlacedAction.TeamType, boardPosition, (troopPlacedAction.TeamType == TeamType.Defender) ? TroopSpawnMode.LeashedToBuilding : TroopSpawnMode.Unleashed, true);
            this.battleController.OnTroopDeployed(troopTypeVO.Uid, troopPlacedAction.TeamType, boardPosition);
        }
        public Entity CreateDroidEntity(CivilianTypeVO droidType, IntPosition position)
        {
            Entity         entity    = this.CreateWalkerBaseEntity(position, droidType.SizeX, droidType.SizeY);
            DroidComponent component = new DroidComponent();

            entity.Add(component);
            entity.Add(new CivilianComponent(droidType));
            Service.Get <EntityViewManager>().LoadEntityAsset(entity);
            return(entity);
        }
        public void HandleSquadTroopsDeployedEvent(object cookie)
        {
            IntPosition            intPosition            = (IntPosition)cookie;
            SquadTroopPlacedAction squadTroopPlacedAction = new SquadTroopPlacedAction();

            squadTroopPlacedAction.Time   = this.GetActionTime();
            squadTroopPlacedAction.BoardX = intPosition.x;
            squadTroopPlacedAction.BoardZ = intPosition.z;
            this.battleRecord.Add(squadTroopPlacedAction);
        }
Exemple #23
0
        public bool IsPlayable(int column, int line, bool isWhite)
        {
            Player currentPlayer = PlayerTurn;

            PlayerTurn = isWhite ? Player.White : Player.Black;
            IntPosition        positionToCheck = new IntPosition(column, line);
            List <IntPosition> playableSlots   = GetAllPossibleMoves();

            PlayerTurn = currentPlayer;
            return(playableSlots.Contains(positionToCheck));
        }
        private void HeroDeployedActionCallback(uint id, object cookie)
        {
            HeroDeployedAction heroDeployedAction = cookie as HeroDeployedAction;
            IDataController    dataController     = Service.Get <IDataController>();
            TroopTypeVO        troopTypeVO        = dataController.Get <TroopTypeVO>(heroDeployedAction.TroopUid);
            IntPosition        boardPosition      = new IntPosition(heroDeployedAction.BoardX, heroDeployedAction.BoardZ);
            SmartEntity        cookie2            = Service.Get <TroopController>().SpawnHero(troopTypeVO, heroDeployedAction.TeamType, boardPosition);

            Service.Get <EventManager>().SendEvent(EventId.AddDecalToTroop, cookie2);
            this.battleController.OnHeroDeployed(troopTypeVO.Uid, heroDeployedAction.TeamType, boardPosition);
        }
Exemple #25
0
        /// <summary>
        /// Creates an AIBoard class given the position of a move to play
        /// and the board where the move has to be played.
        /// </summary>
        /// <param name="position">The position of the pawn to play on the board</param>
        /// <param name="sourceBoard">The board where the move takes place</param>
        /// <returns>A new AIBoard with the updated game state</returns>
        private AIBoard PosToBoard(IntPosition position, AIBoard sourceBoard)
        {
            AIBoard newBoard = new AIBoard
            {
                GameBoard  = sourceBoard.GameBoard,
                PlayerTurn = sourceBoard.PlayerTurn
            };

            newBoard.PlayMove(position.Column, position.Row, PlayerTurn == Player.White);
            return(newBoard);
        }
        public SmartEntity SpawnChampion(TroopTypeVO troopType, TeamType teamType, IntPosition boardPosition)
        {
            TroopSpawnMode spawnMode   = (teamType == TeamType.Defender) ? TroopSpawnMode.LeashedToBuilding : TroopSpawnMode.Unleashed;
            SmartEntity    smartEntity = this.SpawnTroop(troopType, teamType, boardPosition, spawnMode, true, teamType == TeamType.Defender);

            if (smartEntity != null)
            {
                smartEntity.Add(new ChampionComponent(troopType));
            }
            return(smartEntity);
        }
Exemple #27
0
 public static IntPosition NormalizeDeployPosition(IntPosition boardPosition)
 {
     if (boardPosition.z <= -23)
     {
         boardPosition.z = -22;
     }
     if (boardPosition.x <= -23)
     {
         boardPosition.x = -22;
     }
     return(boardPosition);
 }
        private void SpecialAttackDeployedActionCallback(uint id, object cookie)
        {
            SpecialAttackDeployedAction specialAttackDeployedAction = cookie as SpecialAttackDeployedAction;
            IDataController             dataController      = Service.Get <IDataController>();
            SpecialAttackTypeVO         specialAttackTypeVO = dataController.Get <SpecialAttackTypeVO>(specialAttackDeployedAction.SpecialAttackId);
            Vector3 vector = new Vector3(Units.BoardToWorldX(specialAttackDeployedAction.BoardX), 0f, Units.BoardToWorldZ(specialAttackDeployedAction.BoardZ));

            Service.Get <SpecialAttackController>().DeploySpecialAttack(specialAttackTypeVO, specialAttackDeployedAction.TeamType, vector);
            IntPosition boardPosition = Units.WorldToBoardIntPosition(vector);

            this.battleController.OnSpecialAttackDeployed(specialAttackTypeVO.Uid, specialAttackDeployedAction.TeamType, boardPosition);
        }
Exemple #29
0
        private SmartEntity DeployHero(TroopTypeVO troopType)
        {
            if (Service.Get <SimTimeEngine>().IsPaused())
            {
                return(null);
            }
            if (!this.CanDeploy)
            {
                return(null);
            }
            BattleController battleController = Service.Get <BattleController>();

            if (battleController.BattleEndProcessing)
            {
                return(null);
            }
            if (battleController.GetPlayerDeployableHeroCount(troopType.Uid) == 0)
            {
                this.CanDeploy = false;
                Service.Get <EventManager>().SendEvent(EventId.TroopNotPlacedInvalidTroop, this.currentWorldPosition);
                return(null);
            }
            TeamType teamType = TeamType.Attacker;

            if (battleController.GetCurrentBattle().Type == BattleType.PveDefend)
            {
                teamType = TeamType.Defender;
            }
            IntPosition     intPosition     = Units.WorldToBoardIntDeployPosition(this.currentWorldPosition);
            TroopController troopController = Service.Get <TroopController>();

            if (battleController.GetCurrentBattle().IsRaidDefense())
            {
                Entity             entity    = null;
                BoardCell <Entity> boardCell = null;
                if (!troopController.FinalizeSafeBoardPosition(troopType, ref entity, ref intPosition, ref boardCell, TeamType.Attacker, TroopSpawnMode.Unleashed, false))
                {
                    Service.Get <EventManager>().SendEvent(EventId.TroopNotPlacedInvalidArea, intPosition);
                    return(null);
                }
            }
            SmartEntity smartEntity = troopController.SpawnHero(troopType, teamType, intPosition, false);

            if (smartEntity != null)
            {
                base.PlaySpawnEffect(smartEntity);
                this.CanDeploy = false;
                battleController.OnHeroDeployed(troopType.Uid, teamType, intPosition);
                Service.Get <EventManager>().SendEvent(EventId.HeroDeployed, smartEntity);
            }
            return(smartEntity);
        }
Exemple #30
0
        public bool PlayMove(int column, int line, bool isWhite)
        {
            PlayerTurn = isWhite ? Player.White : Player.Black;
            bool IsMoveValid = IsPlayable(column, line, isWhite);

            if (IsMoveValid)
            {
                IntPosition        slotPosition = new IntPosition(column, line);
                List <IntPosition> pawnsToFlip  = GetPawnsToFlip(slotPosition);
                pawnsToFlip.Add(slotPosition);
                UpdateSlots(pawnsToFlip);
            }
            return(IsMoveValid);
        }