Exemple #1
0
    void PopulatePlayer(TileProxy[] sideTiles)
    {
        PlayerMeta player = BaseSaver.GetPlayer();
        //Queue<TileProxy> validTls = new Queue<TileProxy>(GetSideTiles(BoardProxy.PLAYER_TEAM));
        Queue <TileProxy> validTls = new Queue <TileProxy>(sideTiles);
        List <UnitProxy>  units    = new List <UnitProxy>();
        List <Unit>       roster   = new List <Unit>(player.characters);

        roster.Reverse();
        //Debug.Log("PopulatePlayer: " + validTls.Count.ToString());
        List <Unit> inactiveUnits = new List <Unit>();

        for (int i = 3; i < roster.Count; i++)
        {
            inactiveUnits.Add(roster[i]);
        }

        for (int i = 0; i < roster.Count && i < 3; i++)
        {
            Unit cMeta = new Unit(roster[i]);
            //UnitProxy goodGuy = Instantiate(glossary.GetComponent<Glossary>().units[PLAYER_TEAM], transform);
            UnitProxy goodGuy = Instantiate(ClassNode.ComputeClassBaseUnit(cMeta.GetFactionType(),
                                                                           cMeta.GetUnitType(), glossary.GetComponent <Glossary>()), transform);
            units.Add(goodGuy);
            cMeta = ClassNode.ApplyClassBonusesBattle(cMeta, inactiveUnits.ToArray());
            goodGuy.PutData(cMeta);
            goodGuy.Init();
            TileProxy popTile = validTls.Dequeue();
            popTile.ReceiveGridObjectProxy(goodGuy);
            goodGuy.SnapToCurrentPosition();
            //Debug.Log("goodGuy placed at: " + popTile.GetPosition().ToString());
        }
    }
 public override void OnTileSelected(TileProxy tile)
 {
     if (currentUnit != null && visitableTiles.Contains(tile))
     {
         TileProxy startTile = BoardProxy.instance.GetTileAtPosition(currentUnit.GetPosition());
         if (startTile != tile)
         {
             UnitProxy unit = startTile.GetUnit();
             if (unit.GetData().GetTurnActions().CanMove())
             {
                 unit.GetData().GetTurnActions().Move();
                 PanelController.SwitchChar(unit);
                 StartCoroutine(currentUnit.CreatePathToTileAndLerpToPosition(tile,
                                                                              () =>
                 {
                     tile.ReceiveGridObjectProxy(currentUnit);
                     startTile.RemoveGridObjectProxy(currentUnit);
                     UnHighlightTiles();
                     InteractivityManager.instance.EnterDefaultMode();
                 }));
             }
             else
             {
                 Debug.Log("Out of actions. Send signal to player they can't move unit.");
             }
         }
         else
         {
             StartCoroutine(currentUnit.CreatePathToTileAndLerpToPosition(tile,
                                                                          () =>
             {
                 StartCoroutine(ResetTiles());
             }));
         }
     }
     else if (currentUnit != null)
     {
         //Select all the tiles with opp team in all tiles
         //List<TileProxy> visitableTiles = allTiles.Where(tl => tl.GetUnit().GetData().GetTeam() != currentUnit.GetData().GetTeam()).ToList<TileProxy>();
         if (!allTiles.Where(tl => tl.HasUnit() && (tl.GetUnit().GetData().GetTeam() != currentUnit.GetData().GetTeam())).ToList <TileProxy>().Contains(tile))
         {
             BoardProxy.instance.FlushTiles();
             PanelController.SwitchChar(null);
         }
         ////Player clicked out of unit range, reset tiles/UI so player can click somewhere else instead
         //BoardProxy.instance.FlushTiles();
         //PanelController.SwitchChar(null);
     }
 }
Exemple #3
0
    IEnumerator WaitForZap(TileProxy newTl, TileProxy oldTl, string actStr)
    {
        yield return(new WaitForSeconds(AnimationInteractionController.ANIMATION_WAIT_TIME_LIMIT));

        newTl.ReceiveGridObjectProxy(this);
        //newTl.FloatUp(Skill.Actions.None, "whabam!", Color.blue, actStr);
        newTl.CreateAnimation(Glossary.fx.laser, 0);

        oldTl.RemoveGridObjectProxy(this);
        //oldTl.FloatUp(Skill.Actions.None, "poof", Color.cyan, actStr);
        oldTl.CreateAnimation(Glossary.fx.laser, 0);

        SetPosition(newTl.GetPosition());
        SnapToCurrentPosition();
    }
Exemple #4
0
    IEnumerator PopulateSkeleton(Vector3Int pos, UnitProxy unit, int team, int val)
    {
        yield return(new WaitForSeconds(2.2f));

        TileProxy tl = tiles[pos.x, pos.y];
        //if (!tl.HasUnit()) {
        UnitProxy newUnit = Instantiate(unit, transform);

        //newUnit.Init();
        newUnit.PutData(Unit.BuildInitial(Unit.FactionType.Cthulhu, Unit.UnitType.Soldier, team, new CthulhuBaseWisp(), val));
        newUnit.Init();
        newUnit.GetData().SetSummoned(true);
        tl.ReceiveGridObjectProxy(newUnit);
        newUnit.SnapToCurrentPosition();
        //}
    }
Exemple #5
0
    void PopulateEnemies()
    {
        Queue <TileProxy> validTls = new Queue <TileProxy>(GetSideTiles(BoardProxy.ENEMY_TEAM));

        Debug.Log("PopulateEnemies: " + validTls.Count.ToString());
        for (int i = 0; i < boardMeta.enemies.Length && i < height; i++)
        {
            //Unit cMeta = new Unit(boardMeta.enemies[i].name + i.ToString(),1);
            UnitProxy badGuy = Instantiate(glossary.GetComponent <Glossary>().units[ENEMY_TEAM], transform);
            badGuy.PutData(new Unit("e" + i.ToString(), "Snoopy Bot" + i.ToString(), 1, ENEMY_TEAM, 3, 1, 3, 3, 1, 1));
            badGuy.Init();
            TileProxy popTile = validTls.Dequeue();
            popTile.ReceiveGridObjectProxy(badGuy);
            badGuy.SnapToCurrentPosition();
        }
    }
Exemple #6
0
    void PopulatePlayer()
    {
        PlayerMeta        player   = BaseSaver.GetPlayer();
        Queue <TileProxy> validTls = new Queue <TileProxy>(GetSideTiles(BoardProxy.PLAYER_TEAM));

        Debug.Log("PopulatePlayer: " + validTls.Count.ToString());
        for (int i = 0; i < player.characters.Length && i < height; i++)
        {
            Unit      cMeta   = new Unit(player.characters[i]);
            UnitProxy goodGuy = Instantiate(glossary.GetComponent <Glossary>().units[PLAYER_TEAM], transform);
            goodGuy.PutData(cMeta);
            goodGuy.Init();
            TileProxy popTile = validTls.Dequeue();
            popTile.ReceiveGridObjectProxy(goodGuy);
            goodGuy.SnapToCurrentPosition();
        }
    }