Beispiel #1
0
        protected override void OnLoad()
        {
            base.OnLoad();

            Layer = LayerUI;

            lerp = new Lerper(MMW.ClientSize.Height + 40.0f);

            execs.Add("Show", (obj, args) =>
            {
                Show();
                return(true);
            });
            execs.Add("Hide", (obj, args) =>
            {
                Hide();
                return(true);
            });

            tex = new Texture2D(Resources.mmw_icon);
            tex.Load();

            userData  = MMW.GetAsset <UserData>();
            resources = MMW.GetAsset <WorldResources>();

            Show();
        }
Beispiel #2
0
    public void WorldFromString(string info)
    {
        // Destroy old interactable objects
        foreach (WorldObject obj in Utils.Flatten2dArray(WorldController.Instance.ObjectMap))
        {
            if (obj != null)
            {
                Destroy(obj.gameObject);
            }
        }

        // Destroy old actor objects
        foreach (Actor obj in WorldController.Instance.ActorList)
        {
            if (obj != null)
            {
                Destroy(obj.gameObject);
            }
        }

        // Decode world info
        WorldInfo worldInfo = JsonUtility.FromJson <WorldInfo>(info);

        // Set interactable objects
        WorldController.Instance.ObjectMap = new WorldObject[worldInfo.Width, worldInfo.Height];
        foreach (WorldInfo.EntityInfo obj in worldInfo.ObjectArray)
        {
            Vector3     location           = new Vector3(obj.Locx, obj.Locy, 0);
            GameObject  prefab             = WorldResources.GetGameObject(obj.Type);
            WorldObject interactableObject = Instantiate(prefab, location, Quaternion.identity).GetComponent <WorldObject>();
            interactableObject.ObjectFromString(obj.Info);
            WorldController.Instance.ObjectMap[(int)obj.Locx, (int)obj.Locy] = interactableObject;
        }

        // Set tiles
        WorldController.Instance.GroundMap = Utils.Reshape2dArray(worldInfo.GroundArray, worldInfo.Width, worldInfo.Height);
        for (int i = 0; i < WorldController.Instance.Width; i++)
        {
            for (int j = 0; j < WorldController.Instance.Height; j++)
            {
                WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(WorldController.Instance.GroundMap[i, j]));
            }
        }

        // Set actor objects
        WorldController.Instance.ActorList = new Actor[worldInfo.ActorArray.Length];
        for (int i = 0; i < worldInfo.ActorArray.Length; i++)
        {
            Vector3    location = new Vector3(worldInfo.ActorArray[i].Locx, worldInfo.ActorArray[i].Locy, 0);
            GameObject prefab   = WorldResources.GetGameObject(worldInfo.ActorArray[i].Type);
            Actor      actor    = Instantiate(prefab, location, Quaternion.identity).GetComponent <Actor>();
            actor.ObjectFromString(worldInfo.ActorArray[i].Info);
            WorldController.Instance.ActorList[i] = actor;

            if (worldInfo.ActorArray[i].Type == "Player")
            {
                WorldController.Instance.WorldCamera.ToFollow = actor.gameObject;
            }
        }
    }
 public HotbarItemFrame(Control parent, Vector2 pos, int itemIndex)
 {
     Size          = new Vector2(48.0f, 48.0f);
     Parent        = parent;
     LocalLocation = pos;
     ItemIndex     = itemIndex;
     userData      = MMW.GetAsset <UserData>();
     resources     = MMW.GetAsset <WorldResources>();
 }
Beispiel #4
0
    public void CheckResourcesUI()
    {
        WorldResources wres = GameManager.WorldRes;

        for (int i = 0; i < wres.Length; i++)
        {
            if (wres[i] == null)
            {
                continue;
            }
            ResUI[i].Txt[0].text  = wres[i].ToString();
            ResUI[i].Svg[0].color = wres[i].Col;
        }
    }
Beispiel #5
0
 public Chunk(HeightMap grassMap, byte surfaceHeight, byte hillsHeight, WorldResources resources, Vector3 chunkPosition, Point indexInWorldArray)
 {
     IndexInWorldArray   = indexInWorldArray;
     Position            = chunkPosition;
     this.worldResources = resources;
     GrassMap            = grassMap;
     this.surfaceHeight  = surfaceHeight;
     if (surfaceHeight + hillsHeight < 256)
     {
         this.hillsHeight = hillsHeight;
     }
     else
     {
         this.hillsHeight = (byte)(255 - surfaceHeight);
     }
     //GenerateChunkMap();
     //CreateMeshes();
     //SetMaterialMaps();
     //EditMeshesOfMatMaps();
     //SetupMeshes();
 }
Beispiel #6
0
 /// <summary>
 /// Units consume a certain amount froma a certain WorldResources.Type
 /// </summary>
 /// <param name="type"> </param>
 /// <param name="amount"> </param>
 public void Consume(WorldResources.Type type, float amount)
 {
     resources[type] -= (int)((resources[type] - amount < 0) ? resources[type] : amount);
     updateAmounts();
 }
Beispiel #7
0
 /// <summary>
 /// Collect an amount (amount) from a type (type).  
 /// </summary>
 /// <param name="type"></param>
 /// <param name="amount"></param>
 public void Collect(WorldResources.Type type, float amount)
 {
     resources[type] += (int)amount;
     updateAmounts();
 }
Beispiel #8
0
 public bool enoughResources(WorldResources.Type type, float amount)
 {
     return amount <= resources[type];
 }
Beispiel #9
0
 /// <summary>
 /// Removes entity from the main dictionary.
 /// </summary>
 /// <param name="type">Type of resource this entity creates/destroys.</param>
 /// <param name="entity">Entity to Destroy.</param>
 public void RemoveEntity(WorldResources.Type type, IGameEntity entity)
 {
     statistics[type].Remove(entity);
     updateStatistics();
 }
Beispiel #10
0
 public void DisplayResourceDepleted(WorldResources.Type type)
 {
     switch (type)
     {
         case WorldResources.Type.FOOD:
             AppendMessage(NO_FOOD);
             break;
         case WorldResources.Type.METAL:
             AppendMessage(NO_METAL);
             break;
         case WorldResources.Type.WOOD:
             AppendMessage(NO_WOOD);
             break;
         case WorldResources.Type.GOLD:
             AppendMessage(NO_GOLD);
             break;
     }
 }
Beispiel #11
0
 public void DisplayResourceIsLow(WorldResources.Type type)
 {
     switch (type)
     {
         case WorldResources.Type.FOOD:
             AppendMessage(FOOD_LOW);
             break;
         case WorldResources.Type.METAL:
             AppendMessage(METAL_LOW);
             break;
         case WorldResources.Type.WOOD:
             AppendMessage(WOOD_LOW);
             break;
         case WorldResources.Type.GOLD:
             AppendMessage(GOLD_LOW);
             break;
     }
 }
Beispiel #12
0
    void GenerateObstacle(string[] tiles, bool[,] blocked, int locationX, int locationY)
    {
        int sizeX = (int)Math.Floor(Utils.SampleNormal(obstacleSizeMean, obstacleSizeStd));
        int sizeY = (int)Math.Floor(Utils.SampleNormal(obstacleSizeMean, obstacleSizeStd));

        sizeX = locationX + sizeX < blocked.GetUpperBound(0) ? sizeX : blocked.GetUpperBound(0) - locationX;
        sizeY = locationY + sizeY < blocked.GetUpperBound(1) ? sizeY : blocked.GetUpperBound(1) - locationY;

        for (int i = locationX; i < locationX + sizeX; i++)
        {
            for (int j = locationY; j < locationY + sizeY; j++)
            {
                if (i == locationX && j == locationY)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[6]));
                    WorldController.Instance.GroundMap[i, j] = tiles[6];
                }
                else if (i == locationX + sizeX - 1 && j == locationY)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[8]));
                    WorldController.Instance.GroundMap[i, j] = tiles[8];
                }
                else if (i == locationX && j == locationY + sizeY - 1)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[0]));
                    WorldController.Instance.GroundMap[i, j] = tiles[0];
                }
                else if (i == locationX + sizeX - 1 && j == locationY + sizeY - 1)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[2]));
                    WorldController.Instance.GroundMap[i, j] = tiles[2];
                }
                else if (i == locationX)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[3]));
                    WorldController.Instance.GroundMap[i, j] = tiles[3];
                }
                else if (j == locationY)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[7]));
                    WorldController.Instance.GroundMap[i, j] = tiles[7];
                }
                else if (i == locationX + sizeX - 1)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[5]));
                    WorldController.Instance.GroundMap[i, j] = tiles[5];
                }
                else if (j == locationY + sizeY - 1)
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[1]));
                    WorldController.Instance.GroundMap[i, j] = tiles[1];
                }
                else
                {
                    WorldController.Instance.WorldTilemap.SetTile(new Vector3Int(i, j, 0), WorldResources.GetTile(tiles[4]));
                    WorldController.Instance.GroundMap[i, j] = tiles[4];
                }
                blocked[i, j] = true;
            }
        }
    }
Beispiel #13
0
    public static Chunk[] SetStructure(ref WorldResources worldRes, BlockStructure structure)
    {
        List <Chunk> modifiedChunks = new List <Chunk>();
        int          x      = ((int)Mathf.Ceil(16 * ((structure.BuildPointer.x / 16) - ((int)(structure.BuildPointer.x / 16))) + 0.5f) - 1);
        int          Height = (int)Mathf.Ceil(255 * ((structure.BuildPointer.y / 255) - ((int)(structure.BuildPointer.y / 255))) + 0.5f) - 1;
        int          z      = (int)Mathf.Ceil(16 * ((structure.BuildPointer.z / 16) - ((int)(structure.BuildPointer.z / 16))) + 0.5f) - 1;
        int          chunkX = (int)(structure.BuildPointer.x / 16f);
        int          chunkZ = (int)(structure.BuildPointer.z / 16f);

        Chunk selectedChunk;

        Vector3 spawnPointer;

        for (int i = 0; i < structure.Structure.Length; i++)
        {
            int chunkMx = 0;
            int chunkMz = 0;
            spawnPointer = new Vector3((structure.Structure[i].WorldPos.x + x), (structure.Structure[i].WorldPos.y + Height), (structure.Structure[i].WorldPos.z + z));
            if (spawnPointer.x >= 16)
            {
                chunkMx += (int)(spawnPointer.x / 16f);

                spawnPointer.x = spawnPointer.x - 16;
            }
            if (spawnPointer.z >= 16)
            {
                spawnPointer.z = spawnPointer.z - 16;
                chunkMz       += (int)(spawnPointer.z / 16f);
            }

            if (spawnPointer.x < 0)
            {
                spawnPointer.x = -(spawnPointer.x - 16);
                chunkMx       -= (int)(Mathf.Abs(spawnPointer.x) / 16f);


                //Debug.Log($"{Mathf.Abs(spawnPointer.x)} / 16 = {chunkX + chunkMx} ; {spawnPointer.x}");
            }
            if (spawnPointer.z < 0)
            {
                spawnPointer.z = -(spawnPointer.z - 16);
                chunkMz       -= (int)(Mathf.Abs(spawnPointer.z) / 16f);
            }
            if ((chunkZ + chunkMz) < 0 || (chunkZ + chunkMz) >= worldRes.VMG.ChunksRenderDistance || (chunkX + chunkMx) < 0 || (chunkX + chunkMx) >= worldRes.VMG.ChunksRenderDistance)
            {
                continue;
            }

            selectedChunk = worldRes.WorldMap[chunkZ + chunkMz, chunkX + chunkMx];

            try
            {
                selectedChunk.ChunkMap[(int)spawnPointer.y, (int)spawnPointer.z, (int)spawnPointer.x] = structure.Structure[i].ID;
            }
            catch
            {
                Debug.Log($"{spawnPointer.ToString()}");
            }
            if (!IsChunkInList(ref modifiedChunks, ref selectedChunk) == true)
            {
                modifiedChunks.Add(selectedChunk);
            }
        }
        return(modifiedChunks.ToArray());
    }
Beispiel #14
0
        protected override void OnLoad()
        {
            base.OnLoad();

            server = MMW.GetAsset <Server>();

            userData = MMW.GetAsset <UserData>();
            //userData.ArchiveIndex = 6;
            //userData.UserID = "MikuMikuWorldOrg0001";

            MMW.RegistAsset(worldData = new WorldData());

            Resources = new WorldResources(nwWorldData);
            MMW.RegistAsset(Resources);

            // アイテムの整理

            var world = Resources.Worlds.First().Value;

            world.Load();

            var ch = Resources.Characters.First().Value;

            ch.Load();

            MMW.Window.CursorVisible = false;

            worldGO = GameObjectFactory.CreateWorld(world, "world", "Deferred Physical");
            worldGO.AddComponent <CoinSpown>();
            MMW.RegistGameObject(worldGO);

            playerGO = GameObjectFactory.CreatePlayer(ch, "player", ch.Bones != null ? "Deferred Physical Skin" : "Deferred Physical");
            playerGO.Properties["sessionID"] = server.SessionID;
            playerGO.Properties["userID"]    = userData.UserID;
            ch.EyePosition.Z = 0.1f;
            var rb = playerGO.GetComponent <RigidBody>();

            rb.Collide += Rb_Collide;
            rb.Collide += (s, e) =>
            {
                if (e.GameObject.Tags.Contains("coin") && e.GameObject.Tags.Contains("98df1d6abbc7"))
                {
                    e.GameObject.Tags.Remove("coin");
                    e.GameObject.Tags.Remove("98df1d6abbc7");
                    MMW.Invoke(() =>
                    {
                        MMW.DestroyGameObject(e.GameObject);
                        if (e.GameObject.Tags.Contains("cupper coin"))
                        {
                            userData.AddCoin(1);
                        }
                        else if (e.GameObject.Tags.Contains("silver coin"))
                        {
                            userData.AddCoin(5);
                        }
                        else if (e.GameObject.Tags.Contains("gold coin"))
                        {
                            userData.AddCoin(20);
                        }
                    });
                }
            };
            MMW.RegistGameObject(playerGO);
            Players.Add(playerGO);

            cameraTarget = new GameObject("camera target");
            cameraTarget.Transform.Parent   = playerGO.Transform;
            cameraTarget.Transform.Position = new Vector3(0.0f, ch.EyePosition.Y, ch.EyePosition.Z);
            MMW.RegistGameObject(cameraTarget);

            var wp = new WalkerPlayer()
            {
                Name          = userData.UserName,
                SessionID     = server.SessionID,
                ArchiveIndex  = userData.ArchiveIndex,
                CharacterHash = Resources.Characters.First().Key,
                Achivements   = userData.Achivements.ToList(),
                Rank          = userData.Rank,
                LikesCount    = userData.Likes.Count,
                LikedCount    = userData.ReceiveLikes.Count,
                UserID        = userData.UserID,
                Comment       = userData.Comment,
                IsAdmin       = false,
            };

            worldData.Players.Add(wp);

            playerGO.AddComponent <CharacterInfo>(ch, wp);
            playerGO.AddComponent <PlayerMoveController>();
            var cam = playerGO.AddComponent <PlayerCameraController>();

            cam.Target = cameraTarget.Transform;
            playerGO.AddComponent <PlayerRayResolver>();
            playerGO.AddComponent <PlayerHotbarItemResolver>();
            playerGO.AddComponent <UdpSender>();
            playerGO.AddComponent <CharacterPopupResolver>();
            playerGO.AddComponent <CharacterNameResolver>();
            playerGO.AddComponent <DoFResolver>();
            playerGO.AddComponent <WalkerGameObjectScript>(playerGO, new BigHead(), null);

            var env = nwWorldData.Worlds[0].Environments[0];

            MMW.GlobalAmbient = env.Ambient.FromColor4f();
            MMW.DirectionalLight.Intensity = env.DirLight.Intensity;
            MMW.DirectionalLight.Color     = env.DirLight.Color.FromColor4f();
            MMW.DirectionalLight.Direction = env.DirLight.Direction.FromVec3f().Normalized();

            MMW.MainCamera.ShadowMapping = true;
            MMW.MainCamera.GameObject.AddComponent <AudioListener>();
            var effs = MMW.MainCamera.GameObject.GetComponents <ImageEffect>();

            foreach (var eff in effs)
            {
                eff.Enabled = true;
            }

            blur        = MMW.MainCamera.GameObject.AddComponent <Blur>();
            blur.Radius = 0.0f;

            hudGO = new GameObject("hud", "system", "hud");
            //go.Layer = GameObject.LayerUI + 1;
            hudGO.AddComponent <HotBar>();
            hudGO.AddComponent <Aiming>();
            hudGO.AddComponent <CoinResolver>();
            hudGO.AddComponent <ScriptResolver>();
            hudGO.AddComponent <LogResolver>();
            hudGO.AddComponent <ChatResolver>();
            hudGO.AddComponent <PictureChatResolver>();
            hudGO.AddComponent <MenuResolver>();
            hudGO.AddComponent <PublicAchivementResolver>();
            hudGO.AddComponent <LeaveResolver>();
            hudGO.AddComponent <InventiryResolver>();
            MMW.RegistGameObject(hudGO);

            server.BeforeCmds.Add(new CmdAllTransform(this));

            /*
             * foreach (var g in nwWorldData.GameObjects)
             * {
             *  try
             *  {
             *      var wo = Resources.Objects[g.ObjectHash];
             *      if (wo.ItemType == "Put") PutGameObject(g, true);
             *  }
             *  catch { }
             * }
             */

            userData.SessionID     = server.SessionID;
            userData.CharacterHash = Resources.Characters.First().Key;

            server.Disconnected += Server_Disconnected;
            server.SendTcp(Walker.DataType.ResponseReady, Util.SerializeJson(wp));
        }
Beispiel #15
0
    public static SideParams GetSideParamsFromBlock(WorldResources worldRes, Point chunkPosInWorldArray, Vector3 blockPos, bool chunkEdges = true)
    {
        ArrayDimensions CMSize = new ArrayDimensions(worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap.GetLength(0), worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap.GetLength(1), worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap.GetLength(2));

        SideParams sp = new SideParams();

        if (blockPos.x - 1 < 0)
        {
            if (chunkPosInWorldArray.X - 1 < 0)
            {
                sp.Left = chunkEdges;
            }
            else
            {
                if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y, (int)chunkPosInWorldArray.X - 1].ChunkMap[(int)blockPos.z, (int)blockPos.y, (int)CMSize.X - 1] == 0)
                {
                    sp.Left = true;
                }
                else
                {
                    sp.Left = false;
                }
            }
        }
        else
        {
            if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y, (int)blockPos.x - 1] == 0)
            {
                sp.Left = true;
            }
        }

        if (blockPos.y - 1 < 0)
        {
            if (chunkPosInWorldArray.Y - 1 < 0)
            {
                sp.Backward = chunkEdges; //false
            }
            else
            {
                if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y - 1, (int)chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)CMSize.Y - 1, (int)blockPos.x] == 0)
                {
                    sp.Backward = true;
                }
                else
                {
                    sp.Backward = false;
                }
            }
        }
        else
        {
            if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y - 1, (int)blockPos.x] == 0)
            {
                sp.Backward = true;
            }
        }

        if (blockPos.z - 1 < 0)
        {
            sp.Down = false;
        }
        else
        {
            if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z - 1, (int)blockPos.y, (int)blockPos.x] == 0)
            {
                sp.Down = true;
            }
        }

        if (blockPos.x + 1 >= CMSize.X)
        {
            if (chunkPosInWorldArray.X + 1 >= worldRes.WorldMap.GetLength(1))
            {
                sp.Right = chunkEdges; // false
            }
            else
            {
                if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y, (int)chunkPosInWorldArray.X + 1].ChunkMap[(int)blockPos.z, (int)blockPos.y, 0] == 0)
                {
                    sp.Right = true;
                }
                else
                {
                    sp.Right = false;
                }
            }
        }
        else
        {
            if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y, (int)blockPos.x + 1] == 0)
            {
                sp.Right = true;
            }
        }

        if (blockPos.y + 1 >= CMSize.Y)
        {
            if (chunkPosInWorldArray.Y + 1 >= worldRes.WorldMap.GetLength(0))
            {
                sp.Forward = chunkEdges; // false
            }
            else
            {
                if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y + 1, (int)chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, 0, (int)blockPos.x] == 0)
                {
                    sp.Forward = true;
                }
                else
                {
                    sp.Forward = false;
                }
            }
        }
        else
        {
            if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y + 1, (int)blockPos.x] == 0)
            {
                sp.Forward = true;
            }
        }

        if (blockPos.z + 1 >= CMSize.Z)
        {
            sp.Up = false;
        }
        else
        {
            if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z + 1, (int)blockPos.y, (int)blockPos.x] == 0)
            {
                sp.Up = true;
            }
        }
        return(sp);
    }
Beispiel #16
0
 public void OnResourceAmountChanged(WorldResources.Type type, uint newAmmount) {}
Beispiel #17
0
 protected override void OnLoad()
 {
     userData  = MMW.GetAsset <UserData>();
     server    = MMW.GetAsset <Server>();
     resources = MMW.GetAsset <WorldResources>();
 }
Beispiel #18
0
    // Use this for initialization
    void Start()
    {
        //createBackground = this.GetComponent<CreateBackground4>();
        //createShaftBackground = this.GetComponent<CreateShaftBackground>();
        //createWater = this.GetComponent<CreateWaterMesh>();
        //waterElevation = createWater.globalWaterElevation;
        worldResources = this.GetComponent<WorldResources>();
        createWater = this.GetComponent<CreateWater>();
        //GenerateTunnel(new Vector3(0f, 0f, 0f), 1, SelectTunnelTendency());

        GameObject.FindGameObjectWithTag("GameController").GetComponent<TideController>().tideEligible = true;
    }
Beispiel #19
0
 public void DisplayNotEnoughResources(WorldResources.Type type)
 {
     switch (type)
     {
         case WorldResources.Type.FOOD:
             AppendMessage(NOT_ENOUGH_FOOD);
             break;
         case WorldResources.Type.METAL:
             AppendMessage(NOT_ENOUGH_METAL);
             break;
         case WorldResources.Type.WOOD:
             AppendMessage(NOT_ENOUGH_WOOD);
             break;
         case WorldResources.Type.GOLD:
             AppendMessage(NOT_ENOUGH_GOLD);
             break;
     }
 }
Beispiel #20
0
 private void displayResourceInfo(WorldResources.Type resourceType, int tolerance)
 {
     int amount;
     amount = Mathf.FloorToInt(_resourcesPlacer.Amount(resourceType));
     if (amount <= tolerance)
     {
         if (amount > 0)
             events.DisplayResourceIsLow(resourceType);
         else
             events.DisplayResourceDepleted(resourceType);
     }
 }
Beispiel #21
0
 public float Amount(WorldResources.Type type)
 {
     return resources[type];
 }
Beispiel #22
0
 public void Init()
 {
     instance = this;
 }