//void Start () //{ public override void OnStartLocalPlayer() { //if (!isServer) { // return;} //get corresponding team and colorise renderers in team color //Team team = GameManager.GetInstance().teams[teamIndex]; //for (int i = 0; i < renderers.Length; i++) // renderers[i].material.color = tankColor;//team.material; gameIsOver = false; //set name in label label.text = myName; CmdUpdateName(myName); OnHealthChange(health); if (GameManager.GetInstance().localPlayer != null) { return; } //set a global reference to the local player GameManager.GetInstance().localPlayer = this; //isLocalPlayer = true; //get components and set camera target rb = GetComponent <Rigidbody>(); camFollow = GameObject.Find("MainCamera1").GetComponent <FollowTarget>();//Camera.main.GetComponent<FollowTarget>(); camFollow.target = turret; }
void Start() { //get corresponding team and colorise renderers in team color TeamForSinglePlayer team = GameManagerSinglePlayer.GetInstance().teamsForSinglePlayer[teamIndex]; for (int i = 0; i < renderers.Length; i++) { renderers[i].material = team.material; } //set name in label label.text = myName; OnHealthChange(health); if (GameManagerSinglePlayer.GetInstance().localPlayer != null) { return; } //set a global reference to the local player GameManagerSinglePlayer.GetInstance().localPlayer = this; isLocalPlayer = true; //get components and set camera target rb = GetComponent <Rigidbody>(); camFollow = Camera.main.GetComponent <FollowTarget>(); camFollow.target = turret; }
public void Awake() { //get components and set camera target rb = GetComponent <Rigidbody> (); camFollow = Camera.main.GetComponent <FollowTarget>(); camFollow.target = turret; }
void Start() { OnChangeName(myName); OnHealthChange(health); //get components and set camera target rb = GetComponent <Rigidbody>(); if (isLocalPlayer) { GameManager.GetInstance().localPlayer = this; //get the player name stored in player prefs and send it to the server Cmd_SendName(ApplicationData.PlayerName); //inhereted from NetworkBehaviour //isLocalPlayer = true; camFollow = Camera.main.GetComponent <FollowTarget>(); camFollow.target = turret; //mute while testing AudioListener.volume = 0.0f; //need to do it after adding the localplayer, not on gamemanager start() GameManager.GetInstance().GamePause(); } //if (isServer) //{ // //Debug.Log("player: " + GameManager.GetInstance().size.Count); // int newTeamIndex = GameManager.GetInstance().GetTeamFill(); // teamIndex = newTeamIndex; // //get spawn position for this team and instantiate the player there // Vector3 startPos = GameManager.GetInstance().GetSpawnPosition(teamIndex); // //gameObject.transform.SetPositionAndRotation(startPos, Quaternion.identity); // rb.MovePosition(startPos); // GameManager.GetInstance().size[teamIndex]++; // GameManager.GetInstance().Rpc_OnChangeSize(); //} if (isServer) { //GameManager.GetInstance().size[teamIndex]++; GameManager.GetInstance().Rpc_OnChangeSize(); } OnChangeAlive(bAlive); OnChangeIndex(teamIndex); }
/// <summary> /// Initialize synced values on every client. /// Initialize camera and input for this local client. /// </summary> void Start() { m_BulletSpeed = defaultBulletSpeed; lastProjectilePosition.SetParent(null); renderLine = GetComponent <LineRenderer>(); //get corresponding team and colorize renderers in team color Team team = GameManager.GetInstance().teams[GetView().GetTeam()]; // for(int i = 0; i < renderers.Length; i++) // renderers[i].material = team.material; //set name in label label.text = GetView().GetName(); //call hooks manually to update // OnHealthChange(GetView().GetHealth()); OnHealthChange(maxHealth); OnShieldChange(GetView().GetShield()); //called only for this client if (!photonView.isMine) { return; } //set a global reference to the local player GameManager.GetInstance().localPlayer = this; //get components and set camera target rb = GetComponent <Rigidbody>(); camFollow = Camera.main.GetComponent <FollowTarget>(); camFollow.target = turret; //initialize input controls for mobile devices //[0]=left joystick for movement, [1]=right joystick for shooting #if !UNITY_STANDALONE && !UNITY_WEBGL GameManager.GetInstance().ui.controls[0].onDrag += Move; GameManager.GetInstance().ui.controls[0].onDragEnd += MoveEnd; GameManager.GetInstance().ui.controls[1].onDragBegin += ShootBegin; GameManager.GetInstance().ui.controls[1].onDrag += RotateTurret; GameManager.GetInstance().ui.controls[1].onDrag += ShootAndLandMineUi; GameManager.GetInstance().ui.controls[1].onEnter += ShootAndLandMineUi; GameManager.GetInstance().ui.controls[1].onEnterDown += DrawLineProjectileUi; GameManager.GetInstance().ui.controls[1].onEnterUp += ShootProjectileUi; #endif StartCoroutine(OnProjectileShootRoutine()); }
public override void OnStartLocalPlayer() { for (int i = 0; i < renderers.Length; i++) { renderers [i].material.color = Color.blue; } //set name in label label.text = myName; // OnHealthChange (health); rb = GetComponent <Rigidbody> (); camFollow = Camera.main.GetComponent <FollowTarget> (); camFollow.target = turret; }
/// <summary> /// Initialize synced values on every client. /// Initialize camera and input for this local client. /// </summary> void Start() { //get corresponding team and colorize renderers in team color Team team = GameManager.GetInstance().teams[GetView().GetTeam()]; for (int i = 0; i < renderers.Length; i++) { renderers[i].material = team.material; } //set name in label label.text = GetView().GetName(); //call hooks manually to update OnHealthChange(GetView().GetHealth()); OnShieldChange(GetView().GetShield()); //called only for this client if (!photonView.IsMine) { return; } //set a global reference to the local player GameManager.GetInstance().localPlayer = this; //get components and set camera target rb = GetComponent <Rigidbody>(); camFollow = Camera.main.GetComponent <FollowTarget>(); camFollow.target = turret; //initialize input controls for mobile devices //[0]=left joystick for movement, [1]=right joystick for shooting #if !UNITY_STANDALONE && !UNITY_WEBGL GameManager.GetInstance().ui.controls[0].onDrag += Move; GameManager.GetInstance().ui.controls[0].onDragEnd += MoveEnd; GameManager.GetInstance().ui.controls[1].onDragBegin += ShootBegin; GameManager.GetInstance().ui.controls[1].onDrag += RotateTurret; GameManager.GetInstance().ui.controls[1].onDrag += Shoot; #endif }