Exemple #1
0
    public void AddResourceBit(Resource resource, Vector2 from, Vector2 to, System.Action onComplete)
    {
        ResourceBit bit = Object.Instantiate(Assets.ResourceBit);

        bit.transform.SetParent(root, false);
        bit.transform.position = from;
        bit.Init(resource);

        Task.Run()
        .Time(0.5f)
        .OnUpdate(t =>
        {
            bit.transform.position = Vector3.LerpUnclamped(from, to, Ease.InOutSine(t.Progress));
        })
        .OnComplete(_ =>
        {
            onComplete();

            Destroy(bit.gameObject);

            switch (resource)
            {
            case Resource.Lumber:
                UpdateLumber();
                break;

            case Resource.Wheat:
                UpdateWheat();
                break;
            }
        });
    }
Exemple #2
0
    static void LoadPrefabs()
    {
        string path = "Prefabs/";

        Tile        = Resources.Load <Tile>(path + "Tile");
        Peasant     = Resources.Load <Peasant>(path + "Peasant");
        ResourceBit = Resources.Load <ResourceBit>(path + "ResourceBit");
        Effect      = Resources.Load <Effect>(path + "Effect");
    }
Exemple #3
0
            private void LoadDMSGFile(FileTypes type, Languages language, ResourceBit rb)
            {
                String Path = GetFilePath(type, language);
                //int index = GetFileNumber(type, language);

                if (!String.IsNullOrEmpty(Path))
                {
                    d_msgFile en_d_msg = new d_msgFile(Path);

                    if ((en_d_msg == null) || (en_d_msg.EntryList == null) || (en_d_msg.Header == null))
                        return;

                    int Length = (int)en_d_msg.Header.EntryCount;

                    // for each entry
                    for (int i = 0; i < Length; i++)
                    {
                        if ((en_d_msg.EntryList[i] == null) ||
                            (en_d_msg.EntryList[i].data == null) ||
                            (en_d_msg.EntryList[i].data[0] == null) ||
                            (en_d_msg.EntryList[i].data[0].Length <= 0))
                            continue;

                        //if (String.IsNullOrEmpty(en_d_msg.EntryList[i].data[0]) || String.IsNullOrEmpty(en_d_msg.EntryList[i].data[0].Trim('.')))
                        //continue;

                        if (en_d_msg.EntryList[i].data[0].Length > 0)
                        {
                            // SpellNames are special case. To make them match up with FFACETools, we need to double the index.
                            String s = en_d_msg.EntryList[i].data[0];
                            if (type == FileTypes.SpellNames)
                                ResourcesCache.Add((int)((uint)(i * 2) | (uint)rb), s);
                            else
                                ResourcesCache.Add((int)((uint)i | (uint)rb), s);
                        }
                    }
                }
            }