// Use this for initialization void Start() { SPS = GameObject.Find("SoundObject").GetComponent <SoundPlayerScript> (); ES = GameObject.Find("EternalHolder").GetComponent <EternalScript> (); LeftRightPos = new int[4]; UpDownPos = new int[4]; InputAllowedLR = new bool[4]; InputAllowedUD = new bool[4]; InputResetCounterLR = new int[4]; InputResetCounterUD = new int[4]; CurrentSlide = new int[4] { 1, 1, 1, 1 }; CurrentSelectedButton = new int[4]; playerIndex = new PlayerIndex[4]; state = new GamePadState[4]; prevState = new GamePadState[4]; lockedIn = false; NumberOfPlayers = 0; for (int x = 0; x < 4; x++) { playerIndex [x] = (PlayerIndex)x; } if (ES.CheckIfSecondVisit()) { SetOverviewPrimaryText(0, ES.GetPrimary(0)); SetOverviewPrimaryText(1, ES.GetPrimary(1)); SetOverviewPrimaryText(2, ES.GetPrimary(2)); SetOverviewPrimaryText(3, ES.GetPrimary(3)); SetOverviewSecondaryText(0, ES.GetSecondary(0)); SetOverviewSecondaryText(1, ES.GetSecondary(1)); SetOverviewSecondaryText(2, ES.GetSecondary(2)); SetOverviewSecondaryText(3, ES.GetSecondary(3)); } }
string getWeapon(int pNum) { int weaponNum = ES.GetPrimary(pNum); string name = ""; switch (weaponNum) { case 0: name = "Assult Rifle"; break; case 1: name = "Shotgun"; break; case 2: name = "Sniper Rifle"; break; case 3: name = "Grenade Launcher"; break; case 4: name = "Burst Gun"; break; case 5: name = "Boomerang"; break; case 6: name = "Lazer"; break; case 7: name = "Fire Arrow"; break; } return(name); }
void Activate(int PNum) { switch (CurrentSlide[PNum]) { //select player screen move to overview case 1: NumberOfPlayers++; StopAllCoroutines(); ClearNumbers(); GoToOverview(PNum); LeaveStart(PNum); CurrentSelectedButton[PNum] = 0; LeftRightPos[PNum] = 0; UpDownPos [PNum] = 0; ButtonSelectSound(); break; // check what button and go to appropriate slide case 2: SetBoarderDeActive(PNum, CurrentSelectedButton[PNum]); LeaveOverview(PNum); if (CurrentSelectedButton[PNum] == 0) { CurrentSelectedButton[PNum] = ES.GetPrimary(PNum); LeftRightPos[PNum] = ES.GetPrimary(PNum) % 2; if (ES.GetPrimary(PNum) > 5) { UpDownPos [PNum] = 6; } else if (ES.GetPrimary(PNum) > 3) { UpDownPos [PNum] = 4; } else if (ES.GetPrimary(PNum) > 1) { UpDownPos [PNum] = 2; } else { UpDownPos [PNum] = 0; } GoToPrimary(PNum); ButtonSelectSound(); } else if (CurrentSelectedButton[PNum] == 1) { CurrentSelectedButton[PNum] = ES.GetSecondary(PNum); LeftRightPos[PNum] = ES.GetSecondary(PNum) % 2; if (ES.GetSecondary(PNum) > 3) { UpDownPos [PNum] = 4; } else if (ES.GetSecondary(PNum) > 1) { UpDownPos [PNum] = 2; } else { UpDownPos [PNum] = 0; } GoToSecondary(PNum); ButtonSelectSound(); } else if (CurrentSelectedButton[PNum] == 2) { CurrentSelectedButton[PNum] = 0; LeftRightPos[PNum] = (int)(RGBSliderArray[CurrentSelectedButton[PNum] + (PNum * 3)].value * 30); UpDownPos [PNum] = 0; GoToColor(PNum); ButtonSelectSound(); } else if (CurrentSelectedButton[PNum] == 3) { CurrentSelectedButton[PNum] = 0; LeftRightPos[PNum] = 0; UpDownPos [PNum] = 0; ReadyParticles[PNum].SetActive(true); GoToReady(PNum); ButtonSelectSound(); } break; // set primary based on button selection case 3: ES.setPrimary(CurrentSelectedButton[PNum], PNum); SetOverviewPrimaryText(PNum, ES.GetPrimary(PNum)); SetBoarderDeActive(PNum, CurrentSelectedButton[PNum]); LeavePrimary(PNum); CurrentSelectedButton[PNum] = 0; LeftRightPos[PNum] = 0; UpDownPos [PNum] = 0; GoToOverview(PNum); ButtonSelectSound(); break; // set secondary based on button selection case 4: ES.setSecondary(CurrentSelectedButton[PNum], PNum); SetOverviewSecondaryText(PNum, ES.GetSecondary(PNum)); SetBoarderDeActive(PNum, CurrentSelectedButton[PNum]); LeaveSecondary(PNum); CurrentSelectedButton[PNum] = 1; LeftRightPos[PNum] = 0; UpDownPos [PNum] = 1; GoToOverview(PNum); ButtonSelectSound(); break; case 5: SetBoarderDeActive(PNum, CurrentSelectedButton[PNum]); CurrentSelectedButton[PNum] = 2; LeftRightPos[PNum] = 0; UpDownPos [PNum] = 2; GoToOverview(PNum); LeaveColor(PNum); ButtonSelectSound(); break; } }
IEnumerator RespawnSub(int PlayerNum) { yield return(new WaitForSeconds(.1f)); Vector3 SpawnLocation = FindSpawn(PlayerNum); yield return(new WaitForSeconds(Delay)); int PrimaryWeapon, SecondaryWeapon; GameObject tmp; tmp = Instantiate(Character, SpawnLocation, Quaternion.identity) as GameObject; tmp = tmp.GetComponent <ChildReferenceScript> ().getObj(); tmp.GetComponent <SpriteRenderer> ().color = ES.GetColor(PlayerNum); PrimaryWeapon = ES.GetPrimary(PlayerNum); SecondaryWeapon = ES.GetSecondary(PlayerNum); tmp.GetComponent <PlayerControlScript> ().SetController(SpawnWithNoControls, PlayerNum); // set primary weapon if (PrimaryWeapon == 0) { tmp.AddComponent <AssultRifeScript> (); } else if (PrimaryWeapon == 1) { tmp.AddComponent <ShotgunScript> (); } else if (PrimaryWeapon == 2) { tmp.AddComponent <SniperProjectileScript> (); } else if (PrimaryWeapon == 3) { tmp.AddComponent <GrenadeLauncherScript> (); } else if (PrimaryWeapon == 4) { tmp.AddComponent <RngGunScript> (); } else if (PrimaryWeapon == 5) { tmp.AddComponent <BoomerangGunScript> (); } else if (PrimaryWeapon == 6) { tmp.AddComponent <LazerSniperScript> (); } else if (PrimaryWeapon == 7) { tmp.AddComponent <FireBowScript> (); } // set secondary weapon if (SecondaryWeapon == 0) { tmp.AddComponent <GrenadeScript> (); } else if (SecondaryWeapon == 1) { tmp.AddComponent <InterceptorScript> (); } else if (SecondaryWeapon == 2) { tmp.AddComponent <WallGunRevisedScript> (); } else if (SecondaryWeapon == 3) { tmp.AddComponent <SmokeBombScript> (); } else if (SecondaryWeapon == 4) { tmp.AddComponent <ShieldScript> (); } else if (SecondaryWeapon == 5) { tmp.AddComponent <TripMineScript> (); } yield return(new WaitForSeconds(Delay / 2)); }