private void OnTriggerEnter2D(Collider2D collision) { if (!Triggers.Contains(collision.gameObject)) { Triggers.Add(collision.gameObject); switch (Type) { case ButtonType.OneTime: case ButtonType.Toggle: ActionInput Activator = collision.GetComponent <ActionInput>(); if (Activator != null) { Activator.SetToggleTarget(this); //Activator.SetToggleTarget(this, true); } break; case ButtonType.Weighted: UpdateState(true); TellManager(); break; /* * case ButtonType.GenericLocked: * CollectItem Key = collision.GetComponent<CollectItem>(); * if (Key != null) * { * UpdateState(true); * TellManager(); * } * break; */ case ButtonType.TriggeredOnce: ActionInput Blah = collision.GetComponent <ActionInput>(); if (!Toggled && Blah != null) { Toggled = true; Activate(); } break; break; default: break; } } }
private void OnTriggerExit2D(Collider2D collision) { if (Triggers.Contains(collision.gameObject)) { Triggers.Remove(collision.gameObject); switch (Type) { case ButtonType.OneTime: case ButtonType.Toggle: ActionInput Activator = collision.GetComponent <ActionInput>(); if (Activator != null) { Activator.SetToggleTarget(this); //Activator.SetToggleTarget(this, false); } break; case ButtonType.Weighted: UpdateState(false); TellManager(); break; case ButtonType.GenericLocked: CollectItem Key = collision.GetComponent <CollectItem>(); if (Key != null) { UpdateState(false); TellManager(); } break; default: break; } } }