Esempio n. 1
0
    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();
        }
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    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);
        }
    }