void FindObjects(){ playerHpScr = GameObject.Find("testplayer").GetComponent<PlayerHpScript>(); abilitySwitchScr = GameObject.Find("AbilitySwitch").GetComponent<AbilitySwitchScript>(); manaScr = GameObject.Find("Mana Bar").GetComponent<ManaScript>(); enemiesManagerScr = GameObject.Find("enemyManager").GetComponent<EnemiesManagerScript>(); playerManagerScr = GameObject.Find("name").GetComponent<PlayerManager>(); pickupScr = GameObject.Find("name").GetComponent<Pickup>(); }
void EndStunCoroutine() { IEnumerator co = EnemyHpScript.SlowTime(); IEnumerator co2 = PlayerHpScript.SlowTime(); Time.timeScale = 1f; SoundGameplayController.instance.audioSource.pitch = 1; enemyPunchScript.stunned = false; playerPunchScript.stunned = false; StopCoroutine(co); StopCoroutine(co2); }
void Fire() { if (nextAttack - Time.time <= 1f && nextAttack - Time.time > 0f) { } if (Time.time >= nextAttack) { RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, distance, mask); if (hit.collider != null) { PlayerHpScript healthToDamage = hit.collider.GetComponent <PlayerHpScript>(); healthToDamage.PlayerHit(); randomCooldown = Random.Range(2f, 5f); nextAttack = Time.time + randomCooldown; } else { randomCooldown = Random.Range(2f, 5f); nextAttack = Time.time + randomCooldown; } } }
void Start() { playerHp = FindObjectOfType <PlayerHpScript>(); walkAudio.Play(); }