Ejemplo n.º 1
0
        public void SpawnLevelBlossoms()
        {
            SpawnedBlossoms.Clear();

            foreach (string blossom in ExistingBlossoms)
            {
                string blossomCurrentLevel = DialogueLua.GetVariable(blossom + "CurrentLevel").asString;
                // print(blossomCurrentLevel);
                float   blossomCurrentX = DialogueLua.GetVariable(blossom + "CurrentX").asFloat;
                float   blossomCurrentY = DialogueLua.GetVariable(blossom + "CurrentY").asFloat;
                Vector2 blossomPosition = new Vector2(blossomCurrentX, blossomCurrentY);
                if (SceneManager.GetActiveScene().name == blossomCurrentLevel)
                {
                    if (DialogueLua.GetVariable(blossom + "ForSale").asBool == true)
                    {
                        BlossomData newBlossom = Instantiate(BlossomStoreDummy, blossomPosition, transform.rotation);
                        newBlossom.GetComponent <BlossomDataSaver>().ApplyPersistentData(blossom);
                        SpawnedBlossoms.Add(blossom, newBlossom);
                    }
                    else
                    {
                        BlossomData newBlossom = Instantiate(BlossomPrefab, blossomPosition, transform.rotation);
                        newBlossom.GetComponent <BlossomDataSaver>().ApplyPersistentData(blossom);
                        SpawnedBlossoms.Add(blossom, newBlossom);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SpawnBlossom(string pBlossomID, Vector2 pPosition)
        {
            if (ExistingBlossoms.Contains(pBlossomID) == false)
            {
                return;
            }
            if (SpawnedBlossoms.ContainsKey(pBlossomID) == true)
            {
                DespawnBlossom(pBlossomID);
            }
            BlossomData newBlossom = Instantiate(BlossomPrefab, pPosition, transform.rotation);

            newBlossom.GetComponent <BlossomDataSaver>().ApplyPersistentData(pBlossomID);
            SpawnedBlossoms.Add(pBlossomID, newBlossom);
        }