Ejemplo n.º 1
0
    void Start()
    {
        GridMovement map = GameObject.FindObjectOfType <GridMovement>();
        int          max = Mathf.Max(allies.Count, enemies.Count);

        characterLocations = new List <GameObject>(map.tileWidth * map.tileHeight);
        for (int i = 0; i < map.tileWidth * map.tileHeight; ++i)
        {
            characterLocations.Add(null);
        }
        for (int i = 0; i < max; ++i)
        {
            if (i < allies.Count)
            {
                characterLocations[map.ToTileCoordinates(allies[i].transform.position)] = allies[i];
            }
            if (i < enemies.Count)
            {
                characterLocations[map.ToTileCoordinates(enemies[i].transform.position)] = enemies[i];
            }
        }
        path             = new Stack <GameObject>();
        currentTurn      = 0;
        currentCharacter = allies[0];
        character        = currentCharacter.GetComponent <CharacterMovement>();
        canMove          = true;
        speed            = character.speed;
        GetMovementTiles(currentCharacter, speed);
        lastTile = game.map.mapTiles[game.map.ToTileCoordinates(character.transform.position)];
    }