Example #1
0
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "Left_Ref")
     {
         _leafController = other.GetComponentInParent <ILeafController>();
         _leafController.BendUp();
     }
     else if (other.tag == "Right_Ref")
     {
         _leafController = other.GetComponentInParent <ILeafController>();
         _leafController.BendDown();
     }
 }
Example #2
0
    void Update()
    {
        if (Input.GetMouseButton(0) && !EventSystem.current.IsPointerOverGameObject())
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out _hitInfo, RayLength, TargetMask))
            {
                _colliderTag = _hitInfo.collider.tag;

                if (_hitInfo.collider.tag == "Trampoline")
                {
                    _trampolineController = _hitInfo.collider.GetComponent <ITrampolineController>();
                    if (_trampolineController != null)
                    {
                        _trampolineController.activateTrampoline();
                    }
                }

                else if (_hitInfo.collider.tag == "Water_Drop")
                {
                    _leafController = _hitInfo.collider.GetComponentInParent <ILeafController>();
                    _leafController.ActivateParticle();
                }
                instantiateLight(_hitInfo.transform.parent.position);
            }
        }
        // if player release the button the time will reset
        else if (Input.GetMouseButtonUp(0))
        {
            if (_colliderTag.Length > 0)
            {
                if (_colliderTag == "Trampoline")
                {
                    _trampolineController.disableTrampoline();
                }

                else if (_colliderTag == "Water_Drop")
                {
                    _leafController.DeactivateParticle();
                }
            }
            _count = 0;
            destroyLight();
        }
    }