예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        // When player encounters a Bonus, collect and add to PlayerStatistics
        if (other.tag == "Bonus")
        {
            GameControllerCS.instance.PlayerStatistics[1]++;
        }

        // When player encouters a key, collect
        if (other.tag == "Key")
        {
            charInventory.AddItem(currentDoorKeyNeeded);
        }

        // If hit by a bullet, remove health
        else if (other.name == "Bullet")
        {
            GameControllerCS.instance.playerHealth -= EnemyController.instance.weaponDamage;
        }

        if (other.tag == Tags.cameraFOV)
        {
            Debug.Log("Alarm trigered!");
        }

        // If player enters the goal, load scene
        if (other.tag == "Goal")
        {
            Debug.Log("Load next scene here");
            StartCoroutine(GameControllerCS.instance.LoadNextScene("Stats", 1));
            // GameControllerCS.instance.LoadNextScene("Stats", 1);
        }

        Destroy(other.gameObject);              //Always destroy the trigger after
    }
예제 #2
0
    protected override void Interact(Collider player)
    {
        InventoryCS inventory = player.GetComponent <InventoryCS>();

        if (inventory != null && inventory.AddItem(item))
        {
            Destroy(gameObject);
        }
    }