public bool Fire(Vector3 fireDirection, float sizeModifier) { if (m_CurrentAmmo == 0 || m_FireDelay < m_FireRate) { return(false); } m_FireDelay = 0; SetAmmo(-1); GameObject bullet = Instantiate(m_BulletPrefab); if (bullet.GetComponent <Bullet> ().IsFollowingShooter()) { bullet.transform.SetParent(transform, false); } else { bullet.transform.position = transform.position; bullet.GetComponent <SpriteRenderer>().flipX = fireDirection.x < 0; } bullet.transform.localScale *= sizeModifier; bullet.GetComponent <Rigidbody2D> ().velocity = m_AmmoVelocity * fireDirection.normalized; SoundManagerProxy.Get().PlayMultiple(m_FireSound); return(true); }
public void KnockBack(Transform hazardTransfrom) { SoundManagerProxy.Get().PlayMultiple(m_HitSound); m_Mover.CancelVelocity(); m_Mover.ApplyForce(m_KnockBackForce * new Vector2(transform.position.x - hazardTransfrom.position.x , m_KnockBackYCorrectionForce)); StartCoroutine(KnockBackRoutine()); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { Health playerHealth = other.gameObject.GetComponent <Health>(); playerHealth.Heal(m_Heal); SoundManagerProxy.Get().PlayMultiple(m_Sound); Destroy(gameObject); } }
public virtual void Seek(GameObject target) { if (m_IsSeeking || IsDying()) { return; } SoundManagerProxy.Get().PlayMultiple(m_SeekingSound); m_IsSeeking = true; m_Animator.SetTrigger("seeking"); m_Target = target.transform; m_HealthBar.enabled = true; m_Collider.enabled = true; }
IEnumerator SpawnRountine(int binNumber) { m_Animator.SetBool("IsSpawning", true); SoundManagerProxy.Get().PlayMultiple(m_FallingSound); UpdaterProxy.Get().SetPause(true); yield return(new WaitForSeconds(1f)); GameObject binGameObject = GameObject.Instantiate(m_BinPrefab); TileCoordinates coordinates = GetCoordinates(); binGameObject.transform.position = new Vector3(coordinates.x.ToWorldUnit(), coordinates.y.ToWorldUnit(), 0); Bin bin = binGameObject.GetComponent <Bin> (); bin.Init(ETileObjectType.Bin, coordinates.x, coordinates.y, new string[] { binNumber.ToString() }); bin.SetSpawnedCommandNumber(); TileManagerProxy.Get().SetTileObject(coordinates, bin); ms_BinNumber++; UpdaterProxy.Get().SetPause(false); m_Animator.SetBool("IsSpawning", false); }
public void OnGameEvent(DemonFightGameEvent fightEvent) { SoundManagerProxy.Get().PlayMusic(m_BossMusic); StartCoroutine(DemonSpawnRoutine()); }
public void OnGameEvent(GameOverGameEvent gameOver) { gameObject.SetActive(true); SoundManagerProxy.Get().PlayMusic(m_GameOverMusic); }
void Start() { SoundManagerProxy.Get().PlayMusic(m_LevelMusic); }