void Update() { Weapons.PistolSwitch(); Weapons.ShotgunSwitch(); Weapons.MagnumSwitch(); Weapons.BouncerSwitch(); Weapons.LauncherSwitch(); Stage(); GodMode(); Win(); Money(); Weapons.AllWeapons(); if (currentHealth <= 0) { DeadPlayer(); } location = this.gameObject.transform.position; lookDirection = (Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position); lookDirection.Normalize(); if (Input.GetKeyDown(KeyCode.X)) { RaycastHit2D hit = Physics2D.Raycast(rigidbody.position + Vector2.up * 0.2f, lookDirection, 1.5f, LayerMask.GetMask("NPC")); if (hit.collider != null) { NPC character = hit.collider.GetComponent <NPC>(); if (character != null) { character.DisplayDialog(); } } } anim.SetFloat("Look X", lookDirection.x); anim.SetFloat("Look Y", lookDirection.y); if (isInvincible) { invincibleTimer -= Time.deltaTime; if (invincibleTimer < 0) { isInvincible = false; } } if (Input.GetKey(KeyCode.Mouse0)) { if (!dead && canShoot) { StartCoroutine(Launch()); } } }