Esempio n. 1
0
    IEnumerator breakCo()
    {
        thisCollider.enabled = false;
        SoundManager.RequestSound(breakSound);
        yield return(new WaitForSeconds(lootGenerateDelay));

        thisLoot?.GenerateLoot(transform.position);
        yield return(new WaitForSeconds(destroyDelay));

        this.gameObject.SetActive(false);
    }
Esempio n. 2
0
    private void MazeChestGenerationFinished(bool manual)
    {
        Debug.Log("Chests generation finished !");


        List <Container> chests = mazeInstance.Chests;

        if (chests.Count != 0)
        {
            if (keyPrefab != null)
            {
                ItemStageKey key = GameObject.Instantiate(keyPrefab);
                key.Initialize((int)stage);
                if (!chests[0].AddItem(key))
                {
                    mazeInstance.ExitDoor.Locked = false;
                }
            }
            else
            {
                mazeInstance.ExitDoor.Locked = false;
            }

            if (chestLootTable != null)
            {
                foreach (Container chest in chests)
                {
                    chestLootTable.GenerateLoot(chest);
                }
            }
        }
        else
        {
            mazeInstance.ExitDoor.Locked = false;
        }

        if (debugSpawnBeforePathfinding)
        {
            Grid_OnProcessingQueueEmpty(null, new EventArgs());
        }

        if (OnMazeChestGenerationFinished != null)
        {
            OnMazeChestGenerationFinished(this, new EventArgs());
        }
    }
Esempio n. 3
0
    void Update()
    {
        if (_container.isEmpty)
        {
            if (_timeToRefillInHours <= 0.0f)
            {
                if (_container.isEmpty)
                {
                    int numberOfItems = UnityEngine.Random.Range(0, _maxNumberOfItems) + 1;

                    _timeToRefillInHours = _refillDelayInHours;

                    for (int i = 0; i < numberOfItems; i++)
                    {
                        _container.collection.AddPickable(_table.GenerateLoot());
                    }
                }
            }
            else
            {
                _timeToRefillInHours -= (PlayerTime.ScaleTime(Time.deltaTime) / 3600.0f);
            }
        }
    }
Esempio n. 4
0
 void dmg_OnDeath(object sender, System.EventArgs e)
 {
     table.GenerateLoot();
 }