Ejemplo n.º 1
0
 /// <summary>
 /// Unity Function. Check if another game object's collider entered the sky block's collider.
 ///
 /// If it is the needle, break the sky block.
 /// </summary>
 /// <param name="other"></param>
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <NeedleController> () != null)
     {
         NeedleController needle         = other.GetComponent <NeedleController> ();
         NeedleThrowing   needleThrowing = other.gameObject.GetComponent <NeedleThrowing> ();
         this.Split(needle.GetSliceCount(), needle, needleThrowing);
         this.HasBeenHit();
     }
 }
Ejemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     // Only needle can interact on trigger
     if (other.GetComponent <NeedleController> () != null)
     {
         NeedleController needle = other.GetComponent <NeedleController> ();
         this.HitEvents(needle);
         this.Interact(needle.GetSliceCount());
     }
 }
Ejemplo n.º 3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // NOTE: !isFilling is to prevent the player from targeting the object WHILE the filling animation is playing
        if (!isTangible && !isFilling && other.gameObject.CompareTag("Needle") &&
            !other.gameObject.GetComponent <NeedleController>().hasHit)
        {
            Debug.Log("Enter Trigger");
//			this.disabledTransparency ();
            NeedleController needle = other.gameObject.GetComponent <NeedleController> ();
            needle.hasHit = needle.onlyHitOnce;
                        #if UNITY_ANDROID
//			EventManager.DisableJumpButton ();
//			EventManager.ToggleSwitchButton (false);
////			EventManager.Instance.ToggleLeftRightButtons(false);
//			GameController_v7.Instance.GetEventManager().ToggleLeftRightButtons(false);

            Parameters parameters = new Parameters();
            parameters.PutExtra("FLAG", false);
            EventBroadcaster.Instance.PostEvent(EventNames.TOGGLE_JUMP, parameters);

            parameters = new Parameters();
            parameters.PutExtra("FLAG", true);
            EventBroadcaster.Instance.PostEvent(EventNames.TOGGLE_INTERACT, parameters);

            parameters = new Parameters();
            parameters.PutExtra("FLAG", false);
            EventBroadcaster.Instance.PostEvent(EventNames.TOGGLE_SWITCH_WEAPON_BUTTON, parameters);
            EventBroadcaster.Instance.PostEvent(EventNames.TOGGLE_LEFT_RIGHT_BUTTONS, parameters);
                        #endif

            this.clone(needle.GetSliceCount());

            RecordData();
        }
        if (other.gameObject.CompareTag("Player"))
        {
            Debug.Log("PLAYER COLLIDING");
//			animator.SetBool("isCollidingPlayer", true);
        }
        if (other.gameObject.CompareTag("Hammer"))
        {
            Debug.Log("Hammer is colliding");
        }
    }