コード例 #1
0
ファイル: BEnemy.cs プロジェクト: rubohex/V1Rus
    public void SetupEnemy(BGameManager gameManager)
    {
        // Guardamos el gameManager
        this.gameManager = gameManager;

        // Obtenemos el tablero
        board = gameManager.GetActiveBoard();

        // Obtenemos el vector hacia arriba del tablero
        boardUP = board.GetBoardUp();

        // Posicion inicial del jugador en el waypoint 0
        transform.position = board.GetEnemySpawnPos(wayPoints[0].position, GetEnemyBounds().size);

        // Obtenemos el camino que tendra que recorrer el enemigo
        CreatePath();

        // Rotacion inicial mirando hacia el waypoint 1
        transform.rotation = Quaternion.LookRotation(path[1] - path[0], boardUP);

        // Activamos la colision
        GetComponent <CapsuleCollider>().enabled = true;

        // Obtenemos el indice del tablero en el que estamos
        boardIndex = board.PositionToIndex(transform.position);

        // Obtenemos el indice del array de waypoints en el que estamos
        pathIndex = 0;

        // Iniciamos la variable del pathDirection
        pathDirection = 1;

        // Definimos que el enemigo no se esta moviendo
        isMoving = false;

        // Definimos que la partida no se ha acabado todavia
        gameOver = false;
    }