/// <summary> /// All games start from here. /// </summary> /// <returns></returns> private IEnumerator GameCountdown() { while (startCountdown == true && startTimer >= 0) { yield return(new WaitForSeconds(1f)); startTimer--; } if (startCountdown == true) { //BOTTLENECK AND HOOK TO START A GAME // Mark room as "GameStarted" ExitGames.Client.Photon.Hashtable tempRoomTable = PhotonNetwork.room.customProperties; tempRoomTable["GameStarted"] = true; PhotonNetwork.room.SetCustomProperties(tempRoomTable); startTheMatch = true; // used by WaitGUI //Does the following: //set "gameStarted" as true. //GameStarted: // - Triggers WaitUI to go into SpectateMode // if GameStarted is caught in Start() // - Disables WaitUI's polling if GameStarted // - Activates the Fade Effect on the Border Images M.GameStarts(readyTotal); //Does the following: // - Reenabled escape function (disabled during spawn) // TODO: Find use for room size? StageAnimations.Activate(); //Does the following: // - Activates animations for things that need to be in sync Network-wise. GameManager.GameStart(NetID.ConvertToSlot(PhotonNetwork.player.ID), M.GetClientCharacterName()); //Does the following: // - Spawns local player over network. } }
void Awake() { isFrozen = false; //DontDestroyOnLoad(gameObject); anim = GetComponentInChildren <Animator>(); moveRight = 0; moveLeft = 0; controlsPaused = false; myAudioSrc = GetComponent <AudioSource>(); myAudioSrc.clip = DeathNoise; punching = false; isDead = false; StrengthsList = GameObject.FindGameObjectWithTag("Master"). GetComponent <Master>().GetStrengthList(); CBUG.Log("Str List: " + StrengthsList.ToStringFull()); jumpForceTemp = 0f; SpeedTemp = 0f; attackDisableDelay = new WaitForSeconds(AttackLife); facingRight = true; position = new Vector2(); _Rigibody2D = GetComponent <Rigidbody2D>(); jumpsRemaining = TotalJumpsAllowed; _PhotonView = GetComponent <PhotonView>(); _PhotonTransform = GetComponent <PhotonTransformView>(); AttackObjs = new GameObject[3]; AttackObjs[0] = transform.GetChild(3).gameObject; AttackObjs[1] = transform.GetChild(1).gameObject; AttackObjs[2] = transform.GetChild(2).gameObject; _MobileInput = GameObject.FindGameObjectWithTag("MobileController").GetComponent <MobileController>(); spawnPause = 0.5f; spawnPauseWait = new WaitForSeconds(spawnPause); lastHitBy = -1; lastHitTime = Time.time; lastHitForgetLength = 5;//Seconds if (_PhotonView.isMine) { tag = "PlayerSelf"; _PhotonView.RPC("SetSlotNum", PhotonTargets.All, NetID.ConvertToSlot(PhotonNetwork.player.ID)); CamManager.SetTarget(transform); } }