Beispiel #1
0
    private void PlacementBoard(Square _square)
    {
        if (selectedPiece != null)
        {
            if (!_square.Occupied && _square.Team == gameplayManager.Team)
            {
                MoveHeroPiece(selectedPiece.Index, _square.Position, false);
                selectedPiece.HighLight(false);
                selectedPiece = null;
            }

            Unselection();
        }
    }
Beispiel #2
0
    //Placement
    private void PlacementHero(HeroPiece _piece)
    {
        if (selectedPiece != null)
        {
            if (_piece == selectedPiece)
            {
                canUnselect = true;
            }
            else if (_piece != selectedPiece)
            {
                Unselection();
            }
        }
        else if (_piece.Team == gameplayManager.Team)
        {
            Unselection();

            ClickDrag(_piece.transform);
            selectedPiece = _piece;
            selectedPiece.HighLight(true);
            canUnselect = false;
        }
    }
Beispiel #3
0
    //InGame
    public void ClickOnHero(HeroPiece _piece)
    {
        if (step == e_step.Placement)
        {
            PlacementHero(_piece);
            return;
        }

        if (selectedActive != null)
        {
            if (_piece == selectedActive.Piece)
            {
                Unselection();
            }
            else
            {
                Square square = board[_piece.Position.x, _piece.Position.y];
                if (activeList.Contains(square))
                {
                    Square[] targets = new Square[] { square };
                    selectedActive.Piece.ActivePower(targets);

                    Unselection();
                }
            }
        }
        else if (selectedPiece != null)
        {
            if (_piece == selectedPiece)
            {
                canUnselect = true;
            }
            else if (_piece.Team != gameplayManager.Team)
            {
                Square square = board[_piece.Position.x, _piece.Position.y];
                if (attackList.Contains(square))
                {
                    if (selectedPiece.CanMove > 0)
                    {
                        selectedPiece.NotifyMovement(AttackPath(square), true);
                    }

                    Square[] targets = new Square[] { square };
                    selectedPiece.Attack(targets);
                    selectedPiece.HighLight(false);
                    selectedPiece = null;
                }
                Unselection();
            }
            else if (_piece != selectedPiece)
            {
                Unselection();
            }
        }
        else if (_piece.Team == gameplayManager.Team)
        {
            if (_piece.CanMove > 0 || _piece.CanAct > 0)
            {
                Unselection();
                selectedPiece = _piece;
                selectedPiece.HighLight(true);
                canUnselect = false;
                ClickDrag(_piece.transform);

                Ability    atck = selectedPiece.Hero.Attack;
                EffectStat ef   = (EffectStat)atck.Effects[0];

                ef.Value         = -selectedPiece.Stats[e_stats.Damage].CurrentValue;
                atck.Range       = selectedPiece.Stats[e_stats.Range].CurrentValue;
                atck.GetOccupied = true;

                Ability             mov    = selectedPiece.Hero.Move;
                List <e_squareType> exceps = new List <e_squareType>();
                if (selectedPiece.Hero.Fly == false)
                {
                    exceps.Add(e_squareType.Obstacle);
                }

                mov.Range       = selectedPiece.Stats[e_stats.Speed].CurrentValue;
                mov.GetOccupied = false;
                mov.Exceptions  = exceps;

                HighlightHeroRanges();
            }
        }
    }