示例#1
0
    private int dirToIndex(GamePlay.attackDirections atDir)
    {
        int rv = -1;

        if (atDir == GamePlay.attackDirections.Up)
        {
            rv = 0;
        }
        else if (atDir == GamePlay.attackDirections.UpLeft)
        {
            rv = 1;
        }
        else if (atDir == GamePlay.attackDirections.UpRight)
        {
            rv = 2;
        }
        else if (atDir == GamePlay.attackDirections.Down)
        {
            rv = 3;
        }
        else if (atDir == GamePlay.attackDirections.DownLeft)
        {
            rv = 4;
        }
        else if (atDir == GamePlay.attackDirections.DownRight)
        {
            rv = 5;
        }
        else
        {
            Debug.LogError("uknown attack direction");
        }

        return(rv);
    }
示例#2
0
    private GamePlay.attackDirections indexToDir(int index)
    {
        GamePlay.attackDirections rv = GamePlay.attackDirections.Up;
        if (index == 0)
        {
            rv = GamePlay.attackDirections.Up;
        }
        else if (index == 1)
        {
            rv = GamePlay.attackDirections.UpLeft;
        }
        else if (index == 2)
        {
            rv = GamePlay.attackDirections.UpRight;
        }
        else if (index == 3)
        {
            rv = GamePlay.attackDirections.Down;
        }
        else if (index == 4)
        {
            rv = GamePlay.attackDirections.DownLeft;
        }
        else if (index == 5)
        {
            rv = GamePlay.attackDirections.DownRight;
        }
        else
        {
            Debug.LogError("uknown attack direction");
        }

        return(rv);
    }
示例#3
0
    private int OnVerticalLinePlay(int boardFieldId)
    {
        //int startPosId = pawn.gamePlayComp.myHero.GetComponent<Pawn> ().boardPosisionIndex;
        int boardId = pawn.gamePlayComp.GetClosestOverMouseAnyIndexPosition(pawn, false, false, false, false);

        //pawn.gamePlayComp.CreateAttackBeam (startPosId, boardId);
        //pawn.gamePlayComp.ShowMarkForEnemy (boardId, pawn.handIndex);
        //Debug.Log ("Granate board id " + boardId);
        if (attackMark == null)
        {
            //Debug.Log ("Granate  create attack mark " + boardId);
            CreateVerticalLineAttackMarks(boardId);
            lastBoardIndex = boardId;
        }
        if (lastBoardIndex != boardId)
        {
            DestroyVerticalLineAttackMarks();
            if (lastBoardIndex != -1)
            {
                attackDir = GetAttackDir(boardId, lastBoardIndex);
            }
        }
        lastBoardIndex = boardId;
        return(0);
    }
示例#4
0
    private void AttackCallback(int attackedPawnBoardId)
    {
        int nextBoardIndex = -1;

        GamePlay.attackDirections attackDir = pawn.gamePlayComp.GetAttackDirection(pawn.boardPosisionIndex, attackedPawnBoardId);

        if (attackDir == GamePlay.attackDirections.Up)
        {
            nextBoardIndex = pawn.gamePlayComp.GetBoardIndexUp(attackedPawnBoardId);
        }
        else if (attackDir == GamePlay.attackDirections.UpLeft)
        {
            nextBoardIndex = pawn.gamePlayComp.GetBoardIndexUpLeft(attackedPawnBoardId);
        }
        else if (attackDir == GamePlay.attackDirections.UpRight)
        {
            nextBoardIndex = pawn.gamePlayComp.GetBoardIndexUpRight(attackedPawnBoardId);
        }
        else if (attackDir == GamePlay.attackDirections.Down)
        {
            nextBoardIndex = pawn.gamePlayComp.GetBoardIndexDown(attackedPawnBoardId);
        }
        else if (attackDir == GamePlay.attackDirections.DownRight)
        {
            nextBoardIndex = pawn.gamePlayComp.GetBoardIndexDownRight(attackedPawnBoardId);
        }
        else if (attackDir == GamePlay.attackDirections.DownLeft)
        {
            nextBoardIndex = pawn.gamePlayComp.GetBoardIndexDownLeft(attackedPawnBoardId);
        }
        else
        {
            Debug.LogError("uknown attack direction");
        }
        if (nextBoardIndex != -1)
        {
            if (pawn.gamePlayComp.IsFreePosision(nextBoardIndex))
            {
                GameObject pawnGOb = pawn.gamePlayComp.Board [attackedPawnBoardId].Pawn;
                if (pawnGOb != null)
                {
                    Pawn    pawntomove = pawnGOb.GetComponent <Pawn> ();
                    Vector3 newPawnPos = new Vector3(0, 0, 0);
                    pawn.gamePlayComp.RemovePawnFromPosisionImpl(attackedPawnBoardId);
                    pawn.gamePlayComp.PutPawnOnPosisionImpl(pawnGOb, nextBoardIndex);
                    pawntomove.boardPosisionIndex          = nextBoardIndex;
                    pawntomove.boardPosisionIndexPrev      = nextBoardIndex;
                    pawntomove.boardSavedPosisionIndexPrev = nextBoardIndex;
                    newPawnPos   = pawn.gamePlayComp.Board [nextBoardIndex].BoardPiece.transform.localPosition;
                    newPawnPos.z = Pawn.PawnPosDown;
                    pawnGOb.GetComponent <SmothTransform>().SmothTransformTo(newPawnPos, 10f);
                }
            }
        }
    }
示例#5
0
 private void TriggerEffect(int startFieldId, int endFieldId)
 {
     attackDir = indexToDir(startFieldId);
     if (pawn.gamePlayComp.skipAnimations)
     {
         TakeVerticalLineDamageNoAnim(endFieldId);
     }
     else
     {
         StartCoroutine(TakeVerticalLineDamage(endFieldId));
     }
 }
示例#6
0
    private void AddAction(ActionTypeEnum actionType, Pawn myPawn, Pawn enemyPawn, GamePlay.attackDirections attackDirection, int onBoardDistance)
    {
        ActionsNumber++;
        ActionClass action = new ActionClass();

        action.ActionType      = actionType;
        action.myPawn          = myPawn;
        action.enemyPawn       = enemyPawn;
        action.attackDirection = attackDirection;
        action.onBoardDistance = onBoardDistance;
        ActionStack.Add(action);
    }
示例#7
0
 public void DoActionAnimation(ActionTypeEnum actionType,
                               Pawn myPawn, Pawn enemyPawn,
                               GamePlay.attackDirections attackDirection, int onBoardDistance)
 {
     Debug.Log(" == Add animation action " + myPawn.pawnBoardID + " " + actionType);
     AddAction(actionType,
               myPawn, enemyPawn,
               attackDirection, onBoardDistance);
     if (!ActionStarted)
     {
         ActionStarted = true;
         DoNextAction();
     }
 }
示例#8
0
    private void AttackCallback(int attackedPawnBoardId)
    {
        int nextBoardIndex = attackedPawnBoardId;

        GamePlay.attackDirections attackDir = pawn.gamePlayComp.GetAttackDirection(pawn.boardPosisionIndex, attackedPawnBoardId);

        do
        {
            if (attackDir == GamePlay.attackDirections.Up)
            {
                nextBoardIndex = pawn.gamePlayComp.GetBoardIndexUp(nextBoardIndex);
            }
            else if (attackDir == GamePlay.attackDirections.UpLeft)
            {
                nextBoardIndex = pawn.gamePlayComp.GetBoardIndexUpLeft(nextBoardIndex);
            }
            else if (attackDir == GamePlay.attackDirections.UpRight)
            {
                nextBoardIndex = pawn.gamePlayComp.GetBoardIndexUpRight(nextBoardIndex);
            }
            else if (attackDir == GamePlay.attackDirections.Down)
            {
                nextBoardIndex = pawn.gamePlayComp.GetBoardIndexDown(nextBoardIndex);
            }
            else if (attackDir == GamePlay.attackDirections.DownRight)
            {
                nextBoardIndex = pawn.gamePlayComp.GetBoardIndexDownRight(nextBoardIndex);
            }
            else if (attackDir == GamePlay.attackDirections.DownLeft)
            {
                nextBoardIndex = pawn.gamePlayComp.GetBoardIndexDownLeft(nextBoardIndex);
            }
            else
            {
                Debug.LogError("uknown attack direction");
                break;
            }
            if (nextBoardIndex != -1)
            {
                Debug.Log(" destryer attack " + nextBoardIndex);
                pawn.gamePlayComp.DoDamageOnBoard(pawn, nextBoardIndex, pawn.Attack);
            }
        } while (nextBoardIndex != -1);
    }
示例#9
0
 void RPCDoAttack(int myPawnPosIdx, int enemyPawnPosInx, GamePlay.attackDirections attackDirection, int onBoardDistance)
 {
     gPlay.DoAttackImpl(myPawnPosIdx, enemyPawnPosInx, attackDirection, onBoardDistance);
 }