示例#1
0
        public void DoWork(Colony colony, RoamingJobState state)
        {
            state.InitializeActionEnergy(GameLoader.NAMESPACE + ".ManaTankRefill", 0);

            if (state.NextTimeForWork < Time.SecondsSinceStartDouble)
            {
                var energy = state.GetActionEnergy(GameLoader.NAMESPACE + ".ManaTankRefill");

                if (energy > .90)
                {
                    ServerManager.TryChangeBlock(state.Position, ItemId.GetItemId(GameLoader.NAMESPACE + ".TankFull"));
                }
                else if (energy > .75)
                {
                    ServerManager.TryChangeBlock(state.Position, ItemId.GetItemId(GameLoader.NAMESPACE + ".TankThreeQuarter"));
                }
                else if (energy > .50)
                {
                    ServerManager.TryChangeBlock(state.Position, ItemId.GetItemId(GameLoader.NAMESPACE + ".TankHalf"));
                }
                else if (energy > .25)
                {
                    ServerManager.TryChangeBlock(state.Position, ItemId.GetItemId(GameLoader.NAMESPACE + ".TankQuarter"));
                }
                else
                {
                    ServerManager.TryChangeBlock(state.Position, ItemId.GetItemId(GameLoader.NAMESPACE + ".ManaTank"));
                }

                state.NextTimeForWork = Time.SecondsSinceStartDouble + 10;
            }
        }