コード例 #1
0
    public void DecrementBroodDelegateCount(BroodNestDelegate broodDelegate)
    {
        activeBroodDelegateCount--;
        broodDelegate.Died -= DecrementBroodDelegateCount;
        broodDelegate.gameObject.SetActive(false);

        if (activeBroodDelegateCount <= 0)
        {
            hiveShield.PlayAnimation("RemoveShield");
            activeBroodDelegateCount = 0;
        }
    }
コード例 #2
0
    public void SpawnBroodDelegates()
    {
        int randCount = UnityEngine.Random.Range(2, 6);

        activeBroodDelegateCount = 0;
        for (int i = 0; i < randCount; i++)
        {
            int randElement = UnityEngine.Random.Range(0, broodDelegates.Count);

            BroodNestDelegate current = broodDelegates[randElement];
            if (current)
            {
                current.gameObject.SetActive(true);
                current.SetUpBroodNest(this);
                current.Died += DecrementBroodDelegateCount;
                activeBroodDelegateCount++;
            }
        }
    }