Esempio n. 1
0
    void ISpawnManager.DoUpdate(bool ignoreProxThreshMin = false)
    {
        if (OWInfo == null)
        {
            return;
        }

        Vector3 playerPos = CommonObjects.Player_C.Position;

        foreach (Transform child in OWInfo.collectibleSPs)
        {
            CollectibleSpawnPoint s = child.GetComponent <CollectibleSpawnPoint>();
            if (s == null)
            {
                continue;
            }

            float distSqr = (s.transform.position - playerPos).sqrMagnitude;
            if (distSqr > _removalDistSq)
            {
                s.DestroySpawnedCollectible();
            }
            else
            {
                if (s.SpawnedCollectible == null && !s.HasBeenCollected)
                {
                    s.SpawnCollectible();
                }
            }
        }
    }
Esempio n. 2
0
    public void InitWithInfo(Serializable s)
    {
        // Collectible SPs
        foreach (var itemName in s.collectedItems)
        {
            Transform             child = collectibleSPs.Find(itemName);
            CollectibleSpawnPoint csp   = child.GetComponent <CollectibleSpawnPoint>();
            csp.HasBeenCollected = true;
        }

        // Grotto SPs
        _tappedGrottos = new List <string>(s.tappedGrottos);
    }
Esempio n. 3
0
    public Serializable GetInfo()
    {
        Serializable s = new Serializable();

        // Collectible SPs
        List <string> temp = new List <string>();

        foreach (Transform child in collectibleSPs)
        {
            CollectibleSpawnPoint csp = child.GetComponent <CollectibleSpawnPoint>();
            if (csp.HasBeenCollected)
            {
                temp.Add(csp.name);
            }
        }
        s.collectedItems = temp.ToArray();

        // Grotto SPs
        s.tappedGrottos = _tappedGrottos.ToArray();

        return(s);
    }