Exemple #1
0
        private void PerformAttack()
        {
            MonsterAttack newAttack = BulletPooler.Instance.GetPooledObject().GetComponent <MonsterAttack>();

            bullets.Add(newAttack);
            newAttack.Owner = Host;
            newAttack.Initialize(new Vector3(
                                     Host.transform.localPosition.x,
                                     Host.transform.localPosition.y + Host.transform.localScale.y * 0.25f,
                                     Host.transform.localPosition.z),
                                 new Vector3(
                                     Host.TargetAttack.transform.localPosition.x,
                                     Host.TargetAttack.transform.localPosition.y + Host.TargetAttack.transform.localScale.y * 0.25f,
                                     Host.TargetAttack.transform.localPosition.z)
                                 , 0.5f);

            Host.OnDestroyNotify.Attach(o =>
            {
                newAttack.Owner = null;
            });
        }