Exemplo n.º 1
0
    public void SpawnPlayers()
    {
        ParseTeam(Team1, true);
        ParseTeam(Team2, false);

        for (int i = 0; i < this.Team1.Count; i++)
        {
            Unit c = Team1 [i];
            if (c != null)
            {
                c.MoveTo(BoardGenerator.tiles[BoardGenerator.CoordToIndex(0, i * 6)], true);
                //c.GetComponentInParent<MeshRenderer>().material.color = Color.blue;
            }
        }

        for (int i = 0; i < this.Team2.Count; i++)
        {
            Unit c = Team2 [i];
            if (c != null)
            {
                c.MoveTo(BoardGenerator.tiles[BoardGenerator.CoordToIndex(49, i * 6)], true);
                // c.GetComponent<MeshRenderer>().material.color = Color.red;
            }
        }
    }
Exemplo n.º 2
0
    public override void ApplyEffect(Tile tile)
    {
        Unit user = GameplayManager.Instance.UnitSelected;

        for (int i = 0; i < 1 + user.lvl; i++)
        {
            Unit inter = Component.Instantiate(Spawn_Control.Instance.Player).GetComponent <Unit>();
            inter.c    = "INTER";
            inter.name = File.ReadAllLines(".\\name_list.txt")[Random.Range(0, 100)];
            inter.lvl  = user.lvl;
            int stat = 20 * inter.lvl;
            inter.hpMax         = stat;
            inter.currentHP     = inter.hpMax;
            inter.attack        = stat;
            inter.defense       = stat;
            inter.attackMental  = stat;
            inter.defenseMental = stat;
            inter.speed         = 70 * user.lvl;
            inter.range         = 3;
            GameObject o = new GameObject("Inter " + i);
            if (TurnManager.Instance.Team1.Contains(user))
            {
                TurnManager.Instance.Team1.Add(inter);
            }
            else
            {
                TurnManager.Instance.Team2.Add(inter);
            }
            TurnManager.Instance.turnOrder.Add(inter);
            int temp = i;
            int newx = user.CurrentTile.x + (i >= 2 ? 1 : -1);
            int newy = user.CurrentTile.y + (i % 2 == 0 ? -1 : 1);
            inter.MoveTo(BoardGenerator.tiles[BoardGenerator.CoordToIndex(newx, newy)], true);
        }
    }
Exemplo n.º 3
0
 public override void ApplyEffect(Tile tile)
 {
     for (int i = -3; i <= 3; i++)
     {
         for (int j = -3; j <= 3; j++)
         {
             if (Mathf.Abs(i) + Mathf.Abs(j) <= 3)
             {
                 int tileIndex = BoardGenerator.CoordToIndex(tile.x + i, tile.y + j);
                 if (tileIndex >= 0 && tileIndex < BoardGenerator.tiles.Count)
                 {
                     if (BoardGenerator.tiles[tileIndex].Unit != null)
                     {
                         BoardGenerator.tiles[tileIndex].Unit.stun = 2 * TurnManager.Instance.turnOrder.Count;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
    void ParseSACTION(string[] data)
    {
        int x1 = int.Parse(data [1]);
        int y1 = int.Parse(data [2]);
        int x2 = int.Parse(data [3]);
        int y2 = int.Parse(data [4]);

        string actionType = data [5];

        int x3 = int.Parse(data [6]);
        int y3 = int.Parse(data [7]);

        int actionId = int.Parse(data [8]);

        //TODO: itemId ?

        Unit unit            = BoardGenerator.GetUnitAtCoord(x1, y1);
        Tile destinationTile = BoardGenerator.tiles [BoardGenerator.CoordToIndex(x2, y2)];

        if (unit == null)
        {
            unit = GameplayManager.Instance.UnitSelected;
        }

        bool didMove = unit.MoveTo(destinationTile);

        Tile attackedTile = BoardGenerator.tiles [BoardGenerator.CoordToIndex(x3, y3)];

        int attackSucceeded = -1;

        switch (actionType)
        {
        case "atk":
            attackSucceeded = unit.Attack(attackedTile);
            break;

        case "atkspeone":
            attackSucceeded = unit.UseFirstAbility(attackedTile);
            break;

        case "atkspetwo":
            attackSucceeded = unit.UseSecondAbility();
            break;

        case "atkspethree":
            attackSucceeded = unit.UseThirdAbility();
            break;

        case "compspe":
            attackSucceeded = unit.UseSpecialAbility(attackedTile);
            break;

        case "obj":
            //unit.UseObject(attackedTile);
            break;

        case "NOTHING":
            break;
        }

        TurnManager.Instance.NextTurn();
    }