// Used for swapping weapon icons public void SwapSelectedWeapon() { foreach (Transform item in selectedPanel.transform) { Destroy(item.gameObject); } GameObject badge = (GameObject)Instantiate(loadoutbadgePrefab); // under badge a prefab will be instantiated badge.transform.SetParent(selectedPanel.transform, false); // set the parent of the badge badge.transform.localScale = new Vector3(1, 1, 1); // set the position of the badge icon badge.GetComponent <Animator>().enabled = false; Sprite tempSprte = APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].GetComponent <WeaponIcon>().icon; LoadoutBadge badgeScriptRef = badge.GetComponent <LoadoutBadge>(); badgeScriptRef.iconImage.sprite = tempSprte; // get the temporary sprite from the badge reference badgeScriptRef.weaponName = APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].gameObject.name; // get the weapon name from the selected weapon of the tankGunController badgeScriptRef.selectImage.enabled = true; if (APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].GetComponent <WeaponIcon>().isInfinate) { badgeScriptRef.qtyText.text = ""; } else { badgeScriptRef.qtyText.text = APP.PlayerTankManager.GetWeaponQuantity(APP.PlayerTankManager.m_loadout[tankGunController.selectedWeaponIndex].gameObject.name).ToString(); } DEBUG.Log("Weapon has been swapped"); }
//ConnectionRequestListener public void onConnectDone(ConnectEvent eventObj) { Debug.Log("onConnectDone >> " + eventObj.getResult()); DEBUG.Log("ConnectDone >> " + eventObj.getResult()); //DEBUG.Log ("onConnectDone "+eventObj.getResult()); // GameObject camera = GameObject.FindGameObjectWithTag ("LoginPanel"); if (eventObj.getResult() == WarpResponseResultCode.SUCCESS) { loginScript.onConnectedSuccessfully(); m_apppwarp.isConnected = true; } else if (eventObj.getResult() == WarpResponseResultCode.SUCCESS_RECOVERED) { Debug.Log("onConnectDone >> Recovered Done" + eventObj.getResult()); } else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE) { Debug.Log("onConnectDone >> Connection Recoverable" + eventObj.getResult()); StartCoroutine(ReconnectToServer()); } else if (eventObj.getResult() == WarpResponseResultCode.CONNECTION_ERR) { loginScript.onConnectedFail("" + eventObj.getResult()); m_apppwarp.isConnected = false; } }
// Swipe Special Attack - Stego public void Swipe(Animator _dinoAnimator) { if (timerSwipe >= coolDownSwipe) // if swipe is greater or equal to my swipe cool down { if (animator) { animator.enabled = true; } swipe = true; EnableInput(false); _dinoAnimator.SetTrigger("SpecialAttack"); animator.SetInteger("Dinotype", (int)controller.thisTank); if (animator) { animator.SetTrigger("Swipe"); } if (loadoutPanel.specialButtonAnimator) { loadoutPanel.specialButtonAnimator.SetBool("IsReady", false); } loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino); specialHasFired = true; DEBUG.Log("Swipe special attack has been carried out witht the all the animator triggers set"); } }
// The function that is called to display the chooserMenu which basically activates the menu where the player can select a tank and powerups, before the game starts public void ChooserMenu() { if (levelManagerRef.isArcadeMode) // checking if arcade mode has been selected by the LevelManagerRef { if (APP.PlayerTankManager._ArcadeMode == arcadeMode.defend || APP.PlayerTankManager._ArcadeMode == arcadeMode.SearchAndDestroy) { Time.timeScale = 1; loadingOverlay.SetActive(true); SceneManager.LoadScene("ChooseDino"); defendModeSettings.GetChildObject(ArcadeController.instance.playerArmorCollider, "playerBackArmorCollider").gameObject.name = "RearArmorCollider"; defendModeSettings.GetChildObject(ArcadeController.instance.playerArmorCollider, "playerFrontArmorCollider").gameObject.name = "FrontArmorCollider"; ArcadeController.instance.gameObject.SetActive(false); } else { Time.timeScale = 1; loadingOverlay.SetActive(true); SceneManager.LoadScene("ChooseDino"); } DEBUG.Log("Arcade mode has been selected"); } else { loadingOverlay.SetActive(true); Time.timeScale = 1; if (PhotonNetwork.connectionStateDetailed == ClientState.Joined) { Debug.Log("Show Dino selection here"); } else { SceneManager.LoadScene("ChooseDino"); } } }
//Bite Special Attack -TRex public void Bite(Animator _dinoAnimator) { if (timerBite >= coolDownBite) { if (animator) { animator.enabled = true; } bite = true; EnableInput(false); if (animator) { animator.SetTrigger("Bite"); } animator.SetInteger("Dinotype", (int)controller.thisTank); _dinoAnimator.SetTrigger("SpecialAttack"); if (loadoutPanel.specialButtonAnimator) { loadoutPanel.specialButtonAnimator.SetBool("IsReady", false); } loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino); specialHasFired = true; DEBUG.Log("Bite special attack has been carried out witht the all the animator triggers set"); } }
void OnEnable() // always use this for events { EventManager.StartListening("PauseButton", PauseButton, this); EventManager.StartListening("ReturnToGame", ReturnToGame, this); EventManager.StartListening("LevelObjectiveAchieved", GameWon, this); EventManager.StartListening("ShowSettings", HideBackButton, this); EventManager.StartListening("HideSettings", ShowBackButton, this); DEBUG.Log("Pause Menu Acitvated"); }
void OnDisable() { EventManager.StopListening("PauseButton", PauseButton); EventManager.StopListening("ReturnToGame", ReturnToGame); EventManager.StopListening("LevelObjectiveAchieved", GameWon); EventManager.StopListening("ShowSettings", HideBackButton); EventManager.StopListening("HideSettings", ShowBackButton); DEBUG.Log("Pause Menu De-Activated"); }
private void OnTriggerExit(Collider other) { if (other.gameObject.CompareTag("playerTank") || other.gameObject.tag == "Player") { outOfBounds = false; timeLeft = 0; DEBUG.Log("Player is back in the game"); } }
// Coroutine that basically checks which mode is being played and after its completed it will either restart it or quit IEnumerator WaitAndRestartLevel() { yield return(new WaitForSeconds(1)); // seconds to pause before the level is restarted Cursor.lockState = CursorLockMode.None; Cursor.visible = true; if (levelManagerRef.isArcadeMode) { lose.transform.GetChild(4).gameObject.SetActive(false); lose.transform.GetChild(6).gameObject.SetActive(false); lose.GetComponent <Canvas>().enabled = true; ArcadeController.instance.arcadeRetryScreen.GetComponent <Canvas>().enabled = true; ArcadeController.instance.yesButton.gameObject.SetActive(false); ArcadeController.instance.noButton.gameObject.SetActive(false); ArcadeController.instance.info.enabled = false; ArcadeController.instance._Overlay.enabled = false; ArcadeController.instance.reviveText.enabled = false; ArcadeController.instance.waveText.gameObject.SetActive(false); if (APP.PlayerTankManager._ArcadeMode == arcadeMode.defend) { ArcadeController.instance.towerHealth.gameObject.SetActive(false); } if (APP.PlayerTankManager._ArcadeMode == arcadeMode.SearchAndDestroy) { statsPanel.SetActive(true); statsPanel.GetComponent <StatsDisplayController>().PopulateStats(); foreach (GameObject tank in EnemyWaveController.instance.spawnedTanks) { tank.GetComponent <RTCTankController>().targetToAttack = null; tank.GetComponent <RTCTankController>().aiState = aiStates.idle; } lose.transform.GetChild(5).GetComponent <Text>().text = "Round Lost"; ArcadeController.instance.labels.SetActive(false); ArcadeController.instance.playerPanel_RED.SetActive(false); ArcadeController.instance.playerPanel_BLUE.SetActive(false); if (APP.PlayerTankManager.BLUETeamTotalScoresVal == 2) { lose.transform.GetChild(5).GetComponent <Text>().text = "Blue Team Wins"; ArcadeController.instance.arcadeButton.gameObject.SetActive(true); ArcadeController.instance.retryButton.gameObject.SetActive(true); DEBUG.Log("Blue team won"); } ArcadeController.instance.UpdateRounds(); } else { ArcadeController.instance.arcadeButton.gameObject.SetActive(true); ArcadeController.instance.retryButton.gameObject.SetActive(true); } } else { lose.GetComponent <Canvas>().enabled = true; } }
public void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "playerTank" || other.gameObject.tag == "Player") // checking if player tank is in the out of bouns collider { timeLeft = 0; outOfBounds = true; player = other.GetComponentInParent <RTCTankController>(); // grabbing the RTCTankController script from the player Tank DEBUG.Log("Player is now out of bounds"); } }
// Booting up the level manager private void StartLevelManager() { LevelManager levelManager = FindObjectOfType <LevelManager>(); if (levelManager) { DEBUG.Log("Initializing LevelManager...", Warning_Types.Log); levelManager.Initialize(); } }
void HideScopeFade() { if (scopeFade) { scopeFade.SetActive(false); } if (modelRepresentation) { modelRepresentation.gameObject.SetActive(false); } DEBUG.Log("Scope has been hidden"); }
public void onGameSpeedSelected(Dropdown dropdown) { switch (dropdown.value) { case 0: gameTime = GameConstant.GAME_SPEED_REGULAR; break; case 1: gameTime = GameConstant.GAME_SPEED_TURBO; break; } DEBUG.Log("Game Time : " + gameTime); }
// Helps initialize a system when triggered SystemBase CreateSubsystem <T>() where T : SystemBase { T foundSystem = FindObjectOfType <T>(); if (foundSystem) { if (!foundSystem.IsInitialized) { Type foundSysType = typeof(T); DEBUG.Log(foundSysType.FullName + " detected in scene, this is not good as the data could be stale. Will use it for now ", Warning_Types.Warning); foundSystem.Initialize(); foundSystem.IsInitialized = true; foundSystem.gameObject.transform.SetParent(null); DontDestroyOnLoad(foundSystem.gameObject); } foundSystem.name = foundSystem.name + "_FOUND"; Systems.Add(foundSystem); return(foundSystem.GetComponent <SystemBase>()); } // Use reflection to get the prefab name Type systemType = typeof(T); if (systemType == null) { DEBUG.Log("Could not determine the system type for given system", Warning_Types.Error); return(null); } GameObject system = Instantiate(Resources.Load("Managers/" + systemType.FullName) as GameObject, null); DontDestroyOnLoad(system); system.name = system.name.Replace("(Clone)", "_APP"); SystemBase systemBase = system.GetComponent <SystemBase>(); if (systemBase != null) { systemBase.Initialize(); systemBase.IsInitialized = true; systemBase.gameObject.transform.SetParent(transform); } Systems.Add(system.GetComponent <SystemBase>()); DEBUG.Log(systemType.FullName + " created...", Warning_Types.Good); return(system.GetComponent <SystemBase>()); }
public void OnSight(SCSight ret) { if (ret == null) { DEBUG.Error("Invalid Proto"); return; } DEBUG.Log("OnSight"); for (int i = 0; i < ret.Players.Count; ++i) { PlayerInfo info = ret.Players[i]; SetPlayerInfo(info); PlayerManager.Instance.AddOne(this); } }
void ShowScopeFade() { if (scopeFade) { scopeFade.SetActive(true); } if (!modelRepresentation) { modelRepresentation = Instantiate(modelRepresentationPrefab) as GameObject; modelRepresentation.transform.SetParent(null); modelRepresentation.gameObject.SetActive(true); } else { modelRepresentation.gameObject.SetActive(true); } DEBUG.Log("Scope is activated"); }
public void onGameMaximumPlayerSelected(Dropdown dropdown) { switch (dropdown.value) { case 0: maxPlr = 3; break; case 1: maxPlr = 6; break; case 2: maxPlr = 9; break; } DEBUG.Log("Max Plr : " + maxPlr); }
private void generateWinnerPlayers(string sender, string winnerDetails) { DEBUG.Log("Winner Data : " + winnerDetails); JSONArray jsonResponceArray; JSONArray waPotResponceArray = null; if (sender.Equals(appwarp.WA_SERVER_NAME)) { JSON_Object jsonObject = new JSON_Object(winnerDetails); jsonResponceArray = jsonObject.getJSONArray("Table_Pot"); waPotResponceArray = jsonObject.getJSONArray("WA_Pot"); } else { jsonResponceArray = new JSONArray(winnerDetails); } StartCoroutine(winnerBrodcast(sender, jsonResponceArray, waPotResponceArray)); }
void OnReady(params object[] args) { MessageBody body = args[0] as MessageBody; if (body == null) { return; } SCReady ret = ProtoSerialize.DeSerialize <SCReady>(body.data); if (ret == null) { DEBUG.Error("Invalid Proto"); return; } DEBUG.Log("OnReady"); }
public void OnLogin(SCLogin ret) { if (UUID != 0) { DEBUG.Error("Invalid HandeLogin UUID = {0}", UUID); return; } if (ret == null) { DEBUG.Error("Invalid Proto"); return; } UUID = ret.UUID; PlayerManager.Instance.AddOne(this); DEBUG.Log("OnLogin:: UUID={0}", ret.UUID); }
IEnumerator DistributeHandCardsToAllPlayers() { PlayerBean dealerPlayer = playersManager.getDealerPlayer(); GameObject src = dealerPlayer.getCardDeskObject(); GameObject cardDeskPosition = dealerPlayer.getCardDeskPositionObject(); cardDeskPosition.SetActive(true); src.SetActive(true); int i = 0; while (i < playersManager.getAllPlayers().Count) { PlayerBean player = playersManager.getAllPlayers() [i]; // DEBUG.Log ("Name : "+ player.getPlayerName()+" >> "+player.isWaitingForGame()+" >> "+ player.isFoldedPlayer()); if (!player.isWaitingForGame()) { // DEBUG.Log ("Name : "+ player.getPlayerName()+" >< "); GameObject card1Obj = player.getCard1Object(); GameObject card2Obj = player.getCard2Object(); src.transform.position = cardDeskPosition.transform.position; animationManager.MoveCardsObject(src, card1Obj); yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME)); card1Obj.SetActive(true); src.transform.position = cardDeskPosition.transform.position; animationManager.MoveCardsObject(src, card2Obj); yield return(new WaitForSeconds(GameConstant.ANIM_CARD_TIME)); card2Obj.SetActive(true); } else { DEBUG.Log("Name : " + player.getPlayerName()); } i++; } dealerPlayer.getCardDeskObject().SetActive(false); cardDeskPosition.SetActive(false); src.transform.position = cardDeskPosition.transform.position; }
void OnFrameInit(params object[] args) { MessageBody body = args[0] as MessageBody; if (body == null) { return; } SCFrameInit proto = ProtoSerialize.DeSerialize <SCFrameInit>(body.data); if (proto == null) { DEBUG.Error("Invalid Proto"); return; } CurFrameID = proto.CurFrameID; NxtFrameID = proto.NxtFrameID; DEBUG.Log("OnFrameInit:: CurFrameID={0} NxtFrameID={1}", CurFrameID, NxtFrameID); }
public void onCallButtonSelected() { raiseValue = (int)0; SliderChips.value = (float)raiseValue; gameObjectManager.getBetAmountText().text = GameConstant.CURRENCY + raiseValue; RoundManager currentRoundManager = getCurrentRoundInfo(); TurnManager lastActiverPlayerTurn = currentRoundManager.getLastActivePlayerTurn(); int lastBetAmount = currentRoundManager.getTotalPlayerBetAmount(lastActiverPlayerTurn.getPlayer()); int myTotalBetAmount = currentRoundManager.getTotalPlayerBetAmount(playersManager.getPlayerFromName(appwarp.username)); int pendingBetAmount = lastBetAmount - myTotalBetAmount; // DEBUG.Log ("Call >> Last Bet : "+lastBetAmount+" >> My Total Bet : "+myTotalBetAmount+" >> Pending Bet "+pendingBetAmount); if (pendingBetAmount > 0) { // gameObjectManager.getCallButton ().interactable = false; // sendPlayerActionToServer (pendingBetAmount, GameConstant.ACTION_CALL); } else { DEBUG.Log("Bug : Bet Amt : " + pendingBetAmount); } }
public void onGameTypeSelected(Dropdown dropdown) { switch (dropdown.value) { case 0: gameName = GameConstant.GAME_TEXAS_HOLD + " " + GameConstant.GAME_LIMIT; break; case 1: gameName = GameConstant.GAME_TEXAS_HOLD + " " + GameConstant.GAME_NO_LIMIT; break; case 2: gameName = GameConstant.GAME_WHOOPASS + " " + GameConstant.GAME_LIMIT; break; case 3: gameName = GameConstant.GAME_WHOOPASS + " " + GameConstant.GAME_NO_LIMIT; break; } DEBUG.Log("Game Type : " + gameName); }
// Lunge Special Attack - Triceratops public void Lunge(Animator _dinoAnimator) // Takes in an animator for the dino { if (timerLunge >= coolDownLunge) // If lunge timer is greater or equal to the lunge cool down { body.mass = 1000; // Body mass is now 1000 if (animator) { animator.enabled = true; // If i have an animator, enable it } EnableInput(false); // And disable input lunge = true; _dinoAnimator.SetTrigger("SpecialAttack"); // Set the dino animator trigger to be named Special attack animator.SetInteger("Dinotype", (int)controller.thisTank); if (animator) { animator.SetTrigger("Lunge"); // Damage triggered from the animation } loadoutPanel.specialButton.GetComponent <Animator>().SetBool("IsReady", false); loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino); specialHasFired = true; DEBUG.Log("Lunge special attack has been carried out witht the all the animator triggers set"); } }
// Sonic Boom Special Attack - Duckbill public void SonicBoom(Animator _dinoAnimator) // Takes in an animator for the dino { if (timerSonicBoom >= coolDownSonicBoom) // if sonic boom timer is greater or equal to the sonic boom cool down { if (animator) { animator.enabled = true; } sonicboom = true; EnableInput(false); _dinoAnimator.SetTrigger("SpecialAttack"); // Set the dino animator trigger to be named Special attack if (animator) { animator.SetTrigger("SonicBoom"); // Set the dino animator trigger for Sonic Boom } if (loadoutPanel.specialButtonAnimator) { loadoutPanel.specialButtonAnimator.SetBool("IsReady", false); } loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino); specialHasFired = true; DEBUG.Log("Sonic boom special attack has been carried out witht the all the animator triggers set"); } }
// Stomp Special Attack - Bronto public void Stomp(Animator _dinoAnimator) // Takes in an animator for the dino { if (timerStomp >= coolDownStomp) // if stomp timer is greater or equal to my stomp cool down { if (animator) { animator.enabled = true; } stomp = true; EnableInput(false); _dinoAnimator.SetTrigger("SpecialAttack"); animator.SetInteger("Dinotype", (int)controller.thisTank); if (animator) { animator.SetTrigger("Stomp"); } if (loadoutPanel.specialButtonAnimator) { loadoutPanel.specialButtonAnimator.SetBool("IsReady", false); } loadoutPanel.SetSpecialGreyOutBadge(controller.currentDino); DEBUG.Log("Stomp special attack has been carried out witht the all the animator triggers set"); } }
public void OnPlayBtnClick() { mainMenuPanel.SetActive(false); roomListPanel.SetActive(true); DEBUG.Log("Creating game..."); }
public void onGameStakeSelected() { strStake = stakeList[dpStake.value]; DEBUG.Log("Stake : " + strStake); }
public void onGameBuyInSelected() { buyIn = 100 * (dpBuyIn.value + 1); DEBUG.Log("Game Buy : " + buyIn); }