void LocalHandler(GameEvent e) { if (e.GetType() == typeof(Button_GE)) { Button_GE b = (Button_GE)e; if ((sM.C1 == SelectChoice.Ops && ((b.thisPID == PlayerID.p1 && thisSpeaker == Speaker.Ops) || (b.thisPID == PlayerID.p2 && thisSpeaker == Speaker.Doc))) || (sM.C1 == SelectChoice.Doc && ((b.thisPID == PlayerID.p1 && thisSpeaker == Speaker.Doc) || (b.thisPID == PlayerID.p2 && thisSpeaker == Speaker.Ops)))) { if (b.button == Button.Action) { aPressed = b.pressedReleased; } else if (b.button == Button.Dialogue) { yPressed = b.pressedReleased; } else if (b.button == Button.Choice1) { dPadUpPressed = b.pressedReleased; } else if (b.button == Button.Choice2) { dPadDownPressed = b.pressedReleased; } } } else if (e.GetType() == typeof(Stick_GE)) { Stick_GE s = (Stick_GE)e; if ((sM.C1 == SelectChoice.Ops && ((s.thisPID == PlayerID.p1 && thisSpeaker == Speaker.Ops) || (s.thisPID == PlayerID.p2 && thisSpeaker == Speaker.Doc))) || (sM.C1 == SelectChoice.Doc && ((s.thisPID == PlayerID.p1 && thisSpeaker == Speaker.Doc) || (s.thisPID == PlayerID.p2 && thisSpeaker == Speaker.Ops)))) { if (s.stick == Stick.Left) { if (s.leftRight != 0 || s.upDown != 0) { leftStickInputing = true; leftStickAng = Mathf.Atan2(s.upDown, s.leftRight); } else { leftStickInputing = false; } } else { if (s.leftRight != 0 || s.upDown != 0) { rightStickInputting = true; rightStickAng = Mathf.Atan2(s.upDown, s.leftRight); } else { rightStickInputting = false; } } } } }
private void LocalHandler(GameEvent e) { if (e.GetType() == typeof(GE_PreLoadLevel)) { UnSub(); } else if (e.GetType() == typeof(GE_PlayerIngressEgress)) { GE_PlayerIngressEgress p = (GE_PlayerIngressEgress)e; if ((p.myID == PlayerID.p1 && charNum == 0) || (p.myID == PlayerID.p2 && charNum == 1)) { inOutTimer = 0; inOut = p.inTrueOutFalse; SetInOut(p.inTrueOutFalse); } } else if (e.GetType() == typeof(Button_GE)) { if (!inOut && inOutReady) { Button_GE b = (Button_GE)e; if ((b.thisPID == PlayerID.p1 && charNum == 0) || (b.thisPID == PlayerID.p2 && charNum == 1)) { if (b.button == Button.Action && b.pressedReleased) { AButton(b.pressedReleased, charNum); } } } } else if (e.GetType() == typeof(Stick_GE)) { if (!inOut) { Stick_GE s = (Stick_GE)e; if ((s.thisPID == PlayerID.p1 && charNum == 0) || (s.thisPID == PlayerID.p2 && charNum == 1)) { if (s.stick == Stick.Left) { LeftStick(s.upDown, s.leftRight, charNum); } if (s.stick == Stick.Right) { RightStick(s.upDown, s.leftRight, charNum); } } } } }
//private void NewTest(GameEvent e) //{ // Test_GE myE = (Test_GE)e; // Debug.Log(myE.myA + " " + myE.myB + " " + myE.myC + " " + myE.myD); //} //private void TestOutput(GameEvent e) //{ // Device_GE thisE = (Device_GE)e; // Debug.Log((float)thisE.thisDev.LeftStickUp); //} private void OutPut(GameEvent e) { if (e.GetType() == typeof(Stick_GE)) { Stick_GE firedSGE = (Stick_GE)e; if ((int)firedSGE.thisPID == charNum) { if (firedSGE.stick == Stick.Left) { LeftStick((float)firedSGE.upDown, (float)firedSGE.leftRight, (int)firedSGE.thisPID); } else if (firedSGE.stick == Stick.Right) { RightStick((float)firedSGE.upDown, (float)firedSGE.leftRight, (int)firedSGE.thisPID); } } } else if (e.GetType() == typeof(Button_GE)) { Button_GE firedBGE = (Button_GE)e; if ((int)firedBGE.thisPID == charNum) { if (firedBGE.button == Button.Action) { AButton(firedBGE.pressedReleased, (int)firedBGE.thisPID); } else if (firedBGE.button == Button.Dialogue) { YButton(firedBGE.pressedReleased, (int)firedBGE.thisPID); } else if (firedBGE.button == Button.Choice1) { LeftBumper(firedBGE.pressedReleased, (int)firedBGE.thisPID); } else if (firedBGE.button == Button.Choice2) { RightBumper(firedBGE.pressedReleased, (int)firedBGE.thisPID); } } } }
void LocalHandler(GameEvent e) { if (e.GetType() == typeof(GE_PreLoadLevel)) { Unregister(); } else if (e.GetType() == typeof(GE_SubStatus)) { GE_SubStatus s = (GE_SubStatus)e; canMove = s.Move; canGetOut = s.IngEg; } else if (e.GetType() == typeof(GameSaveEvent)) { EventManager.instance.Fire(new GE_GetSubStatus(canMove, canGetOut)); } else if (e.GetType() == typeof(GE_PlayerIngressEgress)) { //Debug.Log("Reading a ingress/egress event"); GE_PlayerIngressEgress p = (GE_PlayerIngressEgress)e; if (p.myID == PlayerID.p1) { p1In = p.inTrueOutFalse; p1InOutTimer = 0; } else { p2In = p.inTrueOutFalse; p2InOutTimer = 0; } } else if (e.GetType() == typeof(Button_GE)) { if (canGetOut) { //Debug.Log("Reading a button event from sub"); Button_GE b = (Button_GE)e; if (b.button == Button.Action && b.pressedReleased) { //Debug.Log("Sending out"); if (p1In && b.thisPID == PlayerID.p1 && p1.GetComponent <PlayerController>().inOutReady) { StartCoroutine("IEInOutP1"); //Debug.Log("P1 was in, now is out"); } if (p2In && b.thisPID == PlayerID.p2 && p2.GetComponent <PlayerController>().inOutReady) { StartCoroutine("IEInOutP2"); //Debug.Log("P2 was in, now is out"); } } } } else if (e.GetType() == typeof(Stick_GE)) { Stick_GE s = (Stick_GE)e; if (p1In && s.thisPID == PlayerID.p1) { if (s.stick == Stick.Left && canMove) { p1MoveVector = new Vector3(s.leftRight, s.upDown, 0) * moveForce; } if (s.stick == Stick.Right) { if (s.upDown == 0 && s.leftRight == 0) { freeze0 = true; } else { //Debug.Log("Right stick inputing player 0"); freeze0 = false; float ang = ((Mathf.Atan2(s.upDown, s.leftRight) * Mathf.Rad2Deg) + 360) % 360; if (ang <= 90f) { desiredAngle = 360; } else { desiredAngle = Mathf.Clamp(ang, 180, 360); } //Debug.Log(desiredAngle); } } } else if (p2In && s.thisPID == PlayerID.p2) { if (s.stick == Stick.Left) { p2MoveVector = new Vector3(s.leftRight, s.upDown, 0) * moveForce; } if (s.stick == Stick.Right) { if (s.upDown == 0 && s.leftRight == 0) { freeze1 = true; } else { //Debug.Log("Right stick inputing player 1"); freeze1 = false; float ang = ((Mathf.Atan2(s.upDown, s.leftRight) * Mathf.Rad2Deg) + 360) % 360; if (ang <= 90f) { desiredAngle = 360; } else { desiredAngle = Mathf.Clamp(ang, 180, 360); } //Debug.Log(desiredAngle); } } } } }