コード例 #1
0
    private void SpawnCollectable(CollectableBase collectableBasePrefab)
    {
        if (collectableBasePrefab != null)
        {
            GameObject obj = InstantiatorHelper.instance.InstantiateObject(collectableBasePrefab.gameObject, this.gameObject);
            obj.transform.position = PositionHandler.instance.InstantiateCollectableInARandomPosition();

            if (PlayerAchivedDataHandler.instance.IsThisCollectableAlreadyConsumedByPlayer(collectableBasePrefab.GetCollectableType()) == false)
            {
                SpawnCollectableTopicDialog(obj, collectableBasePrefab.GetCollectableType());
            }
        }
    }
コード例 #2
0
    public void Spawn()
    {
        var             gObj = Instantiate(CollectableToSpawn, transform.position, Quaternion.identity);
        CollectableBase cb   = gObj.GetComponent <CollectableBase>();

        if (cb == null)
        {
            Debug.LogWarning("Collectable does not extend from collectable base! No callback possible!");
        }
        else
        {
            cb.RequestCallback(HasBeenCollected);
        }
    }
コード例 #3
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Collectable")
        {
            CollectableBase item = other.GetComponent <CollectableBase>();
            switch (item.type)
            {
            case ItemType.Weapon:
                if (hinge.Weapon == null)
                {
                    item.PickUp();
                    hinge.DrawWeapon(item.transform);
                }
                break;

            default:
                Debug.Log("The following Itemtype is not implemented: " + item.type.ToString());
                break;
            }
        }
    }
コード例 #4
0
    private void SpawnRandomCollectable()
    {
        CollectableBase collectableBasePrefab = GetSpecificCollectablePrefabBasedOnType(GetRandomCollectableType());

        SpawnCollectable(collectableBasePrefab);
    }
コード例 #5
0
 public void RemoveCollectable(CollectableBase collectableBase)
 {
     _collectables.Remove(collectableBase);
 }
コード例 #6
0
 public void AddCollectable(CollectableBase collectableBase)
 {
     _collectables.Add(collectableBase);
 }