Пример #1
0
            public override void OnUpdate(float timeStep)
            {
                if (!cutterBuildTimeout.Update(timeStep, true))
                {
                    return;
                }

                if (Player.cutters.Count == TargetNumberOfCutters)
                {
                    Player.currentState = new BuildUnits(this, Player);
                    return;
                }

                if (!Player.type.TreeCutter.Cost.HasResources(Player.Player))
                {
                    return;
                }

                CutterWrapper newCutter = CutterWrapper.CreateNewCutter(Level, Player);

                if (newCutter != null)
                {
                    Player.type.TreeCutter.Cost.TakeFrom(Player.Player);
                    Player.cutters.Add(newCutter.Building, newCutter);
                }
            }
Пример #2
0
            protected void HoldCutters()
            {
                if (Player.cutters.Count >= TargetNumberOfCutters)
                {
                    return;
                }

                if (!Player.type.TreeCutter.Cost.HasResources(Player.Player))
                {
                    return;
                }

                CutterWrapper newCutter = CutterWrapper.CreateNewCutter(Level, Player);

                if (newCutter != null)
                {
                    Player.type.TreeCutter.Cost.TakeFrom(Player.Player);
                    Player.cutters.Add(newCutter.Building, newCutter);
                }
            }