コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 private void OnBulletHitWall(BulletComponent bullet)
 {
     PrefabFactory.Push("bullet", bullet.gameObject);
 }
コード例 #4
0
        private void OnRoundIntro(GameStateTransition obj)
        {
            GameObject sfx = PrefabFactory.Pop("sfxstartup");

            this.DelayAction(4f, () => PrefabFactory.Push("sfxstartup", sfx));
        }