예제 #1
0
    void CheckCollision(Collider other)
    {
        if (!IsOperationable)
        {
            return;
        }

        ObstacleItem obstacle = other.gameObject.GetComponent <ObstacleItem>();

        if (obstacle != null)
        {
            if (energySkillCdController.Active)
            {
                energySkillCdController.Active = false;
            }
            else
            {
                GameControl.Instance.GameOver();
            }
            return;
        }

        BombItem bombItem = other.gameObject.GetComponent <BombItem>();

        if (bombItem != null)
        {
            bombItem.Trigger();
            return;
        }

        bool       eat        = false;
        EnergyItem energyItem = other.gameObject.GetComponent <EnergyItem> ();

        if (energyItem != null)
        {
            energyValueController.AddValue(energyItem.Value);
            eat = true;
        }

        MassItem massItem = other.gameObject.GetComponent <MassItem>();

        if (massItem != null)
        {
            Config config = Config.Instance;
            if (_massItem.Value >= massItem.Value * config.absorbLimit)
            {
                // eat it
                _massItem.Value += massItem.Value * config.absorbRate;
                eat              = true;
            }
        }

        if (eat)
        {
            GameControl.Instance.RemoveItem(other.gameObject);
        }
    }