Exemplo n.º 1
0
        public override IEnumerator ConstructBuilding(GameObject building)
        {
            Entity buildScript = building.GetComponent <Entity>();

            Debug.Log("Construct");

            BattleSystem.CurrentPlayer.ChangeOre(buildScript.Cost * (-1));

            BattleSystem.Player();
            yield return(new WaitForSeconds(0f));
        }
Exemplo n.º 2
0
        public override IEnumerator Start()
        {
            Debug.Log("Move State Active.");

            BattleSystem.UnitInterface.SetActive(false);
            if (!BattleSystem.SelectedUnit.CanMove())
            {
                Debug.Log("Unit can't move this turn.");
                BattleSystem.SetState(new PlayerTurn(BattleSystem));
            }

            yield return(new WaitForSeconds(0f));
        }
Exemplo n.º 3
0
        public override IEnumerator Start()
        {
            Debug.Log("SelectedBilding State Active.");

            BattleSystem.BuildingInterface.SetActive(true);
            BattleSystem.BuildingInterface.transform.localPosition = BattleSystem.PanelPosition(BattleSystem.SelectedBuilding, 1f);
            if (BattleSystem.SelectedBuilding.GetComponent <Factory>())
            {
                Debug.Log("Factory.");
                BattleSystem.SelectedBuilding.GetComponent <Factory>().factoryInterface = BattleSystem.FactoryProduce;
            }

            yield return(new WaitForSeconds(0f));
        }
Exemplo n.º 4
0
        public override IEnumerator Start()
        {
            Debug.Log("SelectedTile State Active.");
            Player tileOwner = BattleSystem.SelectedTile.GetComponent <Tile>().Owner;

            if (tileOwner == BattleSystem.CurrentPlayer || tileOwner == null)
            {
                BattleSystem.BuildingInterface.SetActive(false);
                BattleSystem.TileInterface.SetTileInterface(BattleSystem.SelectedTile.gameObject);
            }
            else
            {
                BattleSystem.Player();
            }

            yield return(new WaitForSeconds(0f));
        }
Exemplo n.º 5
0
        public override IEnumerator Start()
        {
            // Hide all buttons, update hud to display info for current player.
            Debug.Log("PlayerTurn State Active. " + BattleSystem.CurrentPlayer.Name);

            BattleSystem.BuildingInterface.SetActive(false);
            BattleSystem.UnitInterface.SetActive(false);
            BattleSystem.TileInterface.HideUI();
            if (BattleSystem.NewTurn)
            {
                Debug.Log("This is a new turn. Resources are being produced.");
                BattleSystem.NewTurn = false;

                foreach (Tile t in BattleSystem.CurrentPlayer.Tiles)
                {
                    Building build = t.GetComponentInChildren <Building>();
                    if (build == null || build.CompareTag("Fortification"))
                    {
                        continue;
                    }
                    build.PanelButton = BattleSystem.AddToBuildingPanel(build);
                    build.UpdateButtonData();
                    if (BattleSystem.CurrentTurn > build.NextTurnToProduce)
                    {
                        Debug.Log("Producing from " + build.gameObject.name);
                        build.AddToStorage();
                    }
                }
                foreach (Entity e in BattleSystem.CurrentPlayer.Units)
                {
                    if (e == null)
                    {
                        continue;
                    }
                    e.Rest();
                }
            }
            BattleSystem.Interface.SetCurrentPlayer(BattleSystem.CurrentPlayer);

            yield return(new WaitForSeconds(1f));
        }
Exemplo n.º 6
0
        public override IEnumerator Tile()
        {
            //if (BattleSystem.SelectedUnit.Tile.CanStrikeTile(BattleSystem.SelectedTile, BattleSystem.SelectedUnit.GetRange()))
            if (BattleSystem.SelectedUnit.tilesWithinRange.Contains(BattleSystem.SelectedTile))
            {
                HighlightManager.UnHighlightTileList(BattleSystem.SelectedUnit.tilesWithinRange);

                Tile targetTile = BattleSystem.SelectedTile;
                targetTile.strikeParticles.Play();
                if (BattleSystem.SelectedUnit.GetSplash())
                {
                    targetTile.SplashDamage(BattleSystem.SelectedUnit.GetDamage());
                }
                else
                {
                    targetTile.DistributeDamage(BattleSystem.SelectedUnit.GetDamage());
                }
                BattleSystem.SelectedUnit.OnStrike();
            }
            BattleSystem.Player();
            yield return(new WaitForSeconds(0f));
        }
Exemplo n.º 7
0
 public State(BattleSystem battleSystem)
 {
     BattleSystem = battleSystem;
 }
Exemplo n.º 8
0
 public PlayerTurn(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 9
0
        public override IEnumerator Unit()
        {
            yield return(new WaitForSeconds(0f));

            BattleSystem.SetState(new SelectedUnit(BattleSystem));
        }
Exemplo n.º 10
0
 public SelectedBuilding(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 11
0
        public override IEnumerator Building()
        {
            BattleSystem.SetState(new SelectedBuilding(BattleSystem));

            yield return(new WaitForSeconds(0f));
        }
Exemplo n.º 12
0
 public Move(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 13
0
 public SelectedTile(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 14
0
 public Fortify(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 15
0
 public Strike(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 16
0
        public override IEnumerator Fortify(Tile tile)
        {
            yield return(new WaitForSeconds(0f));

            BattleSystem.SetState(new Fortify(BattleSystem));
        }
Exemplo n.º 17
0
 public SelectedUnit(BattleSystem battleSystem) : base(battleSystem)
 {
 }
Exemplo n.º 18
0
 public Begin(BattleSystem battleSystem) : base(battleSystem)
 {
 }