コード例 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (CheckIfItemMatches(collision))//if the player is carrying the right item, change item to ask for
        {
            overlordItemAmount++;
            StartCoroutine(colorChangeScript.CorrectAnswer());//turn green
            pointSystem.AddPoints(1);
            StartCoroutine(BufferTimeBetweenChoosingItems());
            spawn.GetComponent <SpawnItems>().RespawnItems();//this is still nulllllll!
        }

        else
        {
            StartCoroutine(colorChangeScript.WrongAnswer());//if you give the dude the wrong item, he flash red
            CheckForOverlordChanges();
        }

        playerInventory.ableToCollectThings = true;                                   //set you to be able to collect things again
        playerInventory.Inventory           = PlayerInventory.InventoryState.nothing; //i also need to change the item state back to nothing
    }