private void OnBulletHitCharacter(BulletComponent bullet, CharacterComponent character) { character.Hit(); if (character.CurrentHealth <= 0 && bullet.Source != null) { bullet.Source.Player.IncrementScore((bullet.Source == character) ? -1 : 1); //GameObject go = PrefabFactory.Pop("bulletexplode"); //go.transform.position = bullet.transform.position; //this.DelayAction(8, () => PrefabFactory.Push("bulletexplode", go)); GameObject explode = PrefabFactory.Pop("vfxexplode"); explode.transform.position = bullet.transform.position + (UnityEngine.Camera.main.transform.position - bullet.transform.position).normalized; this.DelayAction(5, () => PrefabFactory.Push("vfxexplode", explode)); GameObject shock = PrefabFactory.Pop("shockwave"); shock.transform.position = bullet.transform.position; shock.transform.LookAt(UnityEngine.Camera.main.transform); this.DelayAction(2.2f, () => PrefabFactory.Push("shockwave", shock)); string sfxName = Random.Range(0f, 1f) > 0.5 ? "sfxdeath1" : "sfxdeath2"; GameObject sfx = PrefabFactory.Pop(sfxName); sfx.transform.position = bullet.transform.position; this.DelayAction(4f, () => PrefabFactory.Push(sfxName, sfx)); } PrefabFactory.Push("bullet", bullet.gameObject); }
private void OnBulletShoot(CharacterComponent owner, Vector3 position, Vector3 direction) { GameObject go = PrefabFactory.Pop("bullet"); go.transform.position = position; go.GetComponent <BulletComponent>().Setup(owner, direction); GameObject sfx = PrefabFactory.Pop("sfxshoot"); sfx.transform.position = position; this.DelayAction(2f, () => PrefabFactory.Push("sfxshoot", sfx)); }
private void OnRoundIntro(GameStateTransition obj) { GameObject sfx = PrefabFactory.Pop("sfxstartup"); this.DelayAction(4f, () => PrefabFactory.Push("sfxstartup", sfx)); }