void OnTriggerEnter(Collider other) { CollectableID collectableID = other.gameObject.GetComponent <CollectableID>(); if (collectableID != null) { switch (collectableID.type) { case CollectableType.Point: GameController.PickupPointCrystal(); break; case CollectableType.BoundBonus: GameController.PickupBoundBonus(); break; case CollectableType.Obstacle: GameOver(); break; } Destroy(other.gameObject); } else if (other.tag == boundTag) { GameOver(); } }
void Start() { if (string.IsNullOrEmpty(CollectableID) || CollectableID.Equals("") || CollectableID == "" || CollectableID == null) { CollectableID = CollectableType.ToString() + "_" + transform.position; } GetComponent <Collider>().enabled = true; CollectableCollected = MainGameController.current.HasPlayerCollectedCollectable(CollectableID); GetComponent <Collider>().enabled = !CollectableCollected; gfxParent.SetActive(!CollectableCollected); }
void OnTriggerEnter(Collider other) { CollectableID collectableID = other.GetComponent <CollectableID>(); if (collectableID != null && collectableID.type == CollectableType.Obstacle) { ObstacleHealth oh = other.GetComponent <ObstacleHealth>(); if (oh != null) { oh.Damage(damage); } Destroy(gameObject); } }