Пример #1
0
        public EditorSpawnerData(Dictionary <string, object> rawData)
        {
            assetCode     = JsonUtility.GetString(rawData, TAG_ASSET_CODE);
            spawnerType   = JsonUtility.GetInt(rawData, TAG_SPAWNER_TYPE);
            spawnerMethod = JsonUtility.GetInt(rawData, TAG_SPAWN_METHOD);
            radius        = JsonUtility.GetFloat(rawData, TAG_RADIUS);
            angle         = JsonUtility.GetInt(rawData, TAG_ANGLE);
            spawnInterval = JsonUtility.GetInt(rawData, TAG_INTERVAL);
            spawnRate     = JsonUtility.GetInt(rawData, TAG_SPAWN_RATE);
            maxSpawn      = JsonUtility.GetInt(rawData, TAG_MAX);

            string position = JsonUtility.GetString(rawData, TAG_POSITION);

            string[] points = position.Split(';');
            for (int i = 0; i < points.Length; i++)
            {
                string[] axis = points[i].Split(',');
                Vector2  pos  = new Vector2(float.Parse(axis[0]), float.Parse(axis[1]));
                if (i == 0)
                {
                    spawnStartPos = pos;
                }
                else
                {
                    spawnEndPos = pos;
                }
            }

            spawnItem = new List <SpawnItemData>();
            if (rawData.ContainsKey(TAG_ITEM))
            {
                var listItemObject = rawData[TAG_ITEM] as List <object>;
                for (int i = 0; i < listItemObject.Count; i++)
                {
                    var           itemDictionary = listItemObject[i] as Dictionary <string, object>;
                    SpawnItemData itemData       = new SpawnItemData(itemDictionary);
                    spawnItem.Add(itemData);
                }
            }
        }
Пример #2
0
        private void SetBuffToggle(List <SpawnItemData> buffData)
        {
            toggleEXP.isOn          = false;
            toggleInvisiable.isOn   = false;
            toggleInvulnerable.isOn = false;
            toggleSpeed.isOn        = false;
            toggleGold.isOn         = false;

            for (int i = 0; i < buffData.Count; i++)
            {
                SpawnItemData item = buffData[i];
                switch ((BuffTypeEditor)item.buffType)
                {
                case BuffTypeEditor.Invisible:
                    toggleInvisiable.isOn = true;
                    break;

                case BuffTypeEditor.StarPower:
                    toggleInvulnerable.isOn = true;
                    break;

                case BuffTypeEditor.Speed:
                    toggleSpeed.isOn = true;
                    break;

                case BuffTypeEditor.Gold:
                    toggleGold.isOn = true;
                    break;

                case BuffTypeEditor.Experience:
                    toggleEXP.isOn = true;
                    break;

                default:
                    break;
                }
            }
        }
Пример #3
0
        public void ApplyBuffChange()
        {
            List <SpawnItemData> selectedPowerUp = new List <SpawnItemData>();

            if (toggleInvisiable.isOn)
            {
                SpawnItemData item = new SpawnItemData();
                item.buffType = (int)BuffTypeEditor.Invisible;
                selectedPowerUp.Add(item);
            }
            if (toggleInvulnerable.isOn)
            {
                SpawnItemData item = new SpawnItemData();
                item.buffType = (int)BuffTypeEditor.StarPower;
                selectedPowerUp.Add(item);
            }
            if (toggleSpeed.isOn)
            {
                SpawnItemData item = new SpawnItemData();
                item.buffType = (int)BuffTypeEditor.Speed;
                selectedPowerUp.Add(item);
            }
            if (toggleEXP.isOn)
            {
                SpawnItemData item = new SpawnItemData();
                item.buffType = (int)BuffTypeEditor.Experience;
                selectedPowerUp.Add(item);
            }
            if (toggleGold.isOn)
            {
                SpawnItemData item = new SpawnItemData();
                item.buffType = (int)BuffTypeEditor.Gold;
                selectedPowerUp.Add(item);
            }

            selectedSpawner.SetListItem(selectedPowerUp);
        }