private void CallRespectiveEvents(EventRelay.EventMessageType messageType, MonoBehaviour sender) { if (messageType == EventRelay.EventMessageType.MomentumTrigger) { if (sender.GetComponent <Checkpoint>() == true) { //momentum.OnEventCheckpoint(); } } /* Idle Events for Momentum Drain. Need to keep moving to maintain momentum. */ else if (messageType == EventRelay.EventMessageType.CStateEnter) { /*CStatesBase state = player.fsm.State; * if(state == CStatesBase.Idle) * { * //momentum.OnIdleEnter(); * }*/ } else if (messageType == EventRelay.EventMessageType.CStateExit) { /*CStatesBase state = player.fsm.State; * if (state == CStatesBase.Idle) * { * //momentum.OnIdleExit(); * }*/ } }
string HandleEvent(EventRelay.EventMessageType messageType, MonoBehaviour sender) { if (messageType == EventRelay.EventMessageType.Finish) { hasFinished = true; } if (messageType == EventRelay.EventMessageType.TipOver) { hasLost = true; } if (messageType == EventRelay.EventMessageType.Reset) { hasFinished = false; hasLost = false; } if (eventsHandled.Contains(messageType)) { Debug.Log("Handled Event: " + messageType + " from sender: " + sender); return(this.ToString()); } else { return(this.ToString()); } }
string HandleEvent(EventRelay.EventMessageType messageType, MonoBehaviour sender) { if (eventsHandled.Contains(messageType)) { Debug.Log("Handled Event: " + messageType + " from sender: " + sender); return(this.ToString()); } else { return(this.ToString()); } }
//This method matches the signature of: //public delegate string EventAction(EventMessageType type, MonoBehaviour sender); //This means we can add it to the OnEventAction string HandleEvent(EventRelay.EventMessageType messageType, MonoBehaviour sender) { if (eventsHandled.Contains(messageType)) { Debug.LogWarning("Handled event: " + messageType + " from sender: " + sender + " " + Vector3.Distance(this.transform.position, sender.transform.position) + " units away from me"); CallRespectiveEvents(messageType, sender); //Debug.LogError("1818181818"); return(this.ToString()); } else { //ignore event return(this.ToString()); } }
string HandleEvent(EventRelay.EventMessageType messageType, MonoBehaviour sender) { if (messageType == EventRelay.EventMessageType.Reset) { this.transform.SetPositionAndRotation(startPosition, startRotation); } if (eventsHandled.Contains(messageType)) { Debug.Log("Handled Event: " + messageType + " from sender: " + sender); return(this.ToString()); } else { return(this.ToString()); } }
string HandleEvent(EventRelay.EventMessageType messageType, MonoBehaviour sender) { if (messageType == EventRelay.EventMessageType.SwapControls) { wasd = !wasd; if (wasd) { InputHandler.buttonW = InputHandler.IncreaseY; InputHandler.buttonS = InputHandler.DecreaseY; InputHandler.buttonA = InputHandler.DecreaseX; InputHandler.buttonD = InputHandler.IncreaseX; InputHandler.buttonUP = InputHandler.Unassign_Axis; InputHandler.buttonDOWN = InputHandler.Unassign_Axis; InputHandler.buttonLEFT = InputHandler.Unassign_Axis; InputHandler.buttonRIGHT = InputHandler.Unassign_Axis; } else { InputHandler.buttonW = InputHandler.Unassign_Axis; InputHandler.buttonS = InputHandler.Unassign_Axis; InputHandler.buttonA = InputHandler.Unassign_Axis; InputHandler.buttonD = InputHandler.Unassign_Axis; InputHandler.buttonUP = InputHandler.IncreaseY; InputHandler.buttonDOWN = InputHandler.DecreaseY; InputHandler.buttonLEFT = InputHandler.DecreaseX; InputHandler.buttonRIGHT = InputHandler.IncreaseX; } } if (eventsHandled.Contains(messageType)) { Debug.Log("Handled Event: " + messageType + " from sender: " + sender); return(this.ToString()); } else { return(this.ToString()); } }