public void setUp(GameObject localPlayer) { if (localPlayer == null) { Debug.LogError("passed null local player"); return; } player = localPlayer; if (player != null && player.GetComponent <Identifier>().typePrefix != Identifier.gunnerType) { Debug.LogError("Displaying incorrect HUD"); return; } health = player.GetComponent <NetHealth>(); resourceManager = player.GetComponent <ResourceManager>(); weapons = player.GetComponent <WeaponAttack>(); weapons.weaponWheel = weaponWheel.GetComponent <WeaponWheel>(); setHealth(1); setShield(1); isPaused = false; }
void FixedUpdate() { Vector3 forward = getFoward(); if (!forward.Equals(Vector3.zero) && !transform.position.Equals(Vector3.zero)) { transform.rotation = Quaternion.LookRotation(forward, -grav.getDownDir()); } doMovement(); doRotations(); if (transform.position.magnitude > MapManager.mapSize * 3.5f && MapManager.manager != null && MapManager.manager.mapDoneLocally) //if you fall out come back in { //transform.position = new Vector3(0, -10, 0); player.spawnOnMap(); rb.velocity = Vector3.zero; } if (grav == null) { grav = GetComponent <Gravity>(); } if (health == null) { health = GetComponent <NetHealth>(); } // TODO this shouldn't be here if (grav != null && !grav.inSphere && health != null && health.getHealth() > 0 && MapManager.manager != null && MapManager.manager.mapDoneLocally && TeamManager.singleton != null && !TeamManager.localPlayer.spawned) { //should be in sphere but isnt if (GameEventManager.clockTime > 250) { //enough time has passed that the origonal spawning must have failed Debug.LogError("having to respawn players manually after 250 seconds from game start"); BuildLog.writeLog("having to respawn players manually after 250 seconds from game start"); grav.inSphere = true; TeamManager.singleton.CmdSpawnAllPlayers(); } } }
private void initVars() { pivotPoint = cam.transform.parent.localPosition; velocity = Vector3.zero; rb = GetComponent <Rigidbody>(); health = GetComponent <NetHealth>(); grav = GetComponent <Gravity>(); player = GetComponent <PlayerController>(); id = GetComponent <Identifier>(); if (id.typePrefix == Identifier.magicianType) { attackScript = GetComponent <MagicAttack>(); } else { attackScript = GetComponent <WeaponAttack>(); } isGroundPlanted = false; }
public void setUp(GameObject localPlayer) { if (localPlayer == null) { Debug.LogError("passed null local player"); return; } player = localPlayer; if (player != null && player.GetComponent <Identifier>().typePrefix != Identifier.magicianType) { Debug.LogError("Displaying incorrect HUD"); return; } health = player.GetComponent <NetHealth>(); resourceManager = player.GetComponent <ResourceManager>(); magic = player.GetComponent <MagicAttack>(); setHealth(1); // setShield(); isPaused = false; }
public void onShieldDown() { shieldHealth = null; }
public void onShieldUp(NetHealth health) { shieldHealth = health; }