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()); } } }
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); } }
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; } } }
private void SpawnRandomCollectable() { CollectableBase collectableBasePrefab = GetSpecificCollectablePrefabBasedOnType(GetRandomCollectableType()); SpawnCollectable(collectableBasePrefab); }
public void RemoveCollectable(CollectableBase collectableBase) { _collectables.Remove(collectableBase); }
public void AddCollectable(CollectableBase collectableBase) { _collectables.Add(collectableBase); }