Beispiel #1
0
    public static void KeyCollected(int id)
    {
        if (!isRegistered)
        {
            UnityEngine.SceneManagement.SceneManager.sceneLoaded += (s, m) =>
            {
                // Clear collected keys on scene reload
                if (m == UnityEngine.SceneManagement.LoadSceneMode.Single)
                {
                    keysCollected.Clear();
                }
            };
        }

        keysCollected.Add(id);

        PortalBoss boss = FindObjectOfType <PortalBoss>();

        if (boss)
        {
            boss.UpdateState();
        }

        EffectDoor.instance.Simulate(keysCollected.Count);
    }
Beispiel #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Mage"))
     {
         PortalBoss.KeyCollected(id);
         Destroy(gameObject);
     }
 }
Beispiel #3
0
 public void OnSpawned(char key, int id)
 {
     this.id = id;
     if (PortalBoss.IsKeyCollected(id))
     {
         Destroy(gameObject); // Destoy key if it has already been collected
     }
 }
Beispiel #4
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (invulnerability)
            {
                Destroy(invulnerability.gameObject);
            }
            else
            {
                invulnerability          = Instantiate(invincibilitySpell, Mage.instance.transform, false).GetComponent <SpellSelfInvincible>();
                invulnerability.fadeTime = 0F;
            }
        }

        if (Input.GetKeyDown(KeyCode.Insert))
        {
            PortalBoss.KeyCollected(Random.Range(int.MinValue, 0));
        }
    }