void SpawnPickupableObject()
    {
        PickupableObjects obj = Instantiate(pickupablePrefab[(int)typeToSpawn], spawnPosition.position,
                                            Quaternion.identity).GetComponent <PickupableObjects>();

        lastSpawned = obj.gameObject;
    }
Beispiel #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "PickupableObject" && other.isTrigger == false)
        {
            PickupableObjects obj = other.GetComponent <PickupableObjects>();

            if (obj.ObjectType != acceptedType)
            {
                return;
            }

            if (obj.ObjectType != PickupableObjectType.Trash)
            {
                OnObjectReceived?.Invoke(activeQuest);
            }
            else
            {
                questFinishAction?.Invoke(obj.AssignedQuest);
            }

            Destroy(other.gameObject);
            //OnObjectReceived = null;
        }
    }