private void Start() { skillNormCol = skillCooldownImg.color; if (Instance == null) { Instance = this; } else { Destroy(gameObject); } if (!plr && FindObjectOfType <Player>()) { plr = FindObjectOfType <Player>(); } if (!wepChange) { wepChange = WeaponChange.Instance; } if (!hatSwitch && FindObjectOfType <HatSwitch>()) { hatSwitch = FindObjectOfType <HatSwitch>(); } if (!wavSpawner) { wavSpawner = hatSwitch.gameObject.GetComponent <WaveSpawner>(); } if (hat != null) { if (hatSwitch) { hatSwitch.ChangeHat(hat.sprt, hat.dashLength, hat.dashRegen, hat.dashDmg, hat.spd); } } skillInfoImg.gameObject.SetActive(false); skillName.text = ""; skillDesc.text = ""; cam = Camera.main; }
private void Respawn() { hud.timeLeft = 0f; respawning = false; Vector3 posToSpawnAt = new Vector3(plrRespawnPoints[h].position.x, plrRespawnPoints[h].position.y, -10f); Transform plr = Instantiate(plrPref, posToSpawnAt, Quaternion.identity) as Transform; hud.ResetPlr(plr.GetComponent <Player>()); camFoll.target = plr; if (Player.Stats.hat != null) { hatSwitch.ChangeHat(Player.Stats.hat.sprt, Player.Stats.hat.dashLength, Player.Stats.hat.dashRegen, Player.Stats.hat.dashDmg, Player.Stats.hat.spd); } plr.GetComponent <Player>().Initialize(this); plr.GetComponent <PlayerMovement>().movJoystick = mvStick; plr.GetComponent <MouseFollow>().movJoystick = mvStick; plr.GetComponent <MouseFollow>().rotJoystick = rotStick; wepChange.WeaponChangeInven(wepChange.weaponObjectsInInventory[wepChange.currentWeaponId], wepChange.currentWeaponId, wepChange.weaponDamageInInventory[wepChange.currentWeaponId]); }