示例#1
0
    public void MoveToNode(Vector3 targetPos)
    {
        aiLerp.ResetToDefault();
        mapSCR.RemoveCharacterPosition(gameObject, isAlly);
        //mapSCR.RemoveCharacterPosition(gameObject, isAlly, tempCellPos);
        charMng.playerCell = null;
        tempCellPos        = targetPos;
        ShipCell cellToGo = mapSCR.SetCharacterPosition(gameObject, isAlly, tempCellPos);

        charMng.playerCell = cellToGo;
        StopAllCoroutines();
        if (cellToGo == null)
        {
            moveCoroutine = Move(targetPos);
        }
        else
        {
            moveCoroutine = Move(cellToGo.position);
        }
        StartCoroutine(moveCoroutine);
    }
示例#2
0
    public void MovePlayer(int roomIndex, int map)
    {
        // récupere une cell vide
        if (selectedPlayer == null)
        {
            return;
        }
        shipMapSCR.RemoveCharacterPosition(selectedPlayer, selectedPlayer.GetComponent <PlayerMovement>().isAlly);
        ShipCell freeCell = GetFreeCellInRoom(roomIndex, map);

        if (freeCell != null)
        {
            Vector3 targetPos = freeCell.position;
            selectedPlayer.GetComponent <PlayerMovement>().MoveToNode(targetPos);
        }
    }