Exemple #1
0
    public Unit SpawnTroop(Unit troop, IPlayer controller, ITile tile, HexDirection orientation)
    {
        Unit unit = Instantiate(troop);

        unit.Direction          = (int)orientation;
        unit.transform.rotation = Quaternion.Euler(0, orientation.DirectionRotation(), 0);
        Vector3 tilePosition = new Vector3(tile.PosX, tile.PosY, tile.PosZ);

        unit.transform.position = tilePosition + Vector3.up * unit.DisplacementY;

        hexControl.PlaceUnit(unit, tile.X, tile.Z);
        unit.Initialize(controller, hexControl, this);
        return(unit);
    }