Esempio n. 1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (OnFilterHandler.Invoke(other))
     {
         OnTriggerEnterHandler.Invoke(this);
     }
 }
    public void OnGameplayStarted()
    {
        Ball.onBallEnteredTrigger += handleTriggerEnter;
        Ball.onBallExitedTrigger  += handleTriggerExit;

        multipliers = Object.FindObjectsOfType <Multiplier>();
        locks       = Object.FindObjectsOfType <Lock>();
        windZones   = Object.FindObjectsOfType <LocalWindZone>();
        portals     = Object.FindObjectsOfType <Portal>();

        key = Object.FindObjectOfType <Key>();

        foreach (var multiplier in multipliers)
        {
            ballSystem.AddBallSpawner(multiplier);
        }

        foreach (var @lock in locks)
        {
            ballSystem.AddBallSpawner(@lock);
            ballSystem.AddBallDestroyer(@lock);
        }

        onTriggerEnterChain =
            new OnTriggerEnterHandler(multipliers,
                                      new OnTriggerEnterHandler(locks,
                                                                new OnTriggerEnterHandler(windZones,
                                                                                          new OnTriggerEnterHandler(portals, null))));

        onTriggerExitChain =
            new OnTriggerExitHandler(windZones, null);
    }
Esempio n. 3
0
        void OnDestroy()
        {
            if (OnTriggerEnterHandler != null)
            {
                foreach (System.Delegate d in OnTriggerEnterHandler.GetInvocationList())
                {
                    OnTriggerEnterHandler -= (System.Action <GameObject, Collider>)d;
                }
            }

            if (OnTriggerExitHandler != null)
            {
                foreach (System.Delegate d in OnTriggerExitHandler.GetInvocationList())
                {
                    OnTriggerExitHandler -= (System.Action <GameObject, Collider>)d;
                }
            }

            if (OnCollisionEnterHandler != null)
            {
                foreach (System.Delegate d in OnCollisionEnterHandler.GetInvocationList())
                {
                    OnCollisionEnterHandler -= (System.Action <GameObject, Collision>)d;
                }
            }

            if (OnCollisionExitHandler != null)
            {
                foreach (System.Delegate d in OnCollisionExitHandler.GetInvocationList())
                {
                    OnCollisionExitHandler -= (System.Action <GameObject, Collision>)d;
                }
            }

            if (OnControllerColliderHitHandler != null)
            {
                foreach (System.Delegate d in OnControllerColliderHitHandler.GetInvocationList())
                {
                    OnControllerColliderHitHandler -= (System.Action <GameObject, ControllerColliderHit>)d;
                }
            }
        }
 public OnTriggerEnterHandler(IEnumerable <InteractableStageEntity> stageEntities, OnTriggerEnterHandler successor) :
     base((trigger) => stageEntities.FirstOrDefault(x => trigger == x.Collider), successor)
 {
 }
 public OnTriggerEnterHandler(System.Func <Collider, IInteractWithBallOnEnter> getActor, OnTriggerEnterHandler successor) :
     base(getActor, successor)
 {
 }