Exemple #1
0
        public override void StartEffect(AbilityData data, Action finished)
        {
            Animator animator = data.GetUser().GetComponent <Animator>();

            animator.SetTrigger(animationTrigger);
            finished();
        }
        private void SpawnProjectileForTargetPoint(AbilityData data, Vector3 spawnPosition)
        {
            Projectile projectile = Instantiate(projectileToSpawn);

            projectile.transform.position = spawnPosition;
            projectile.SetTarget(data.GetTargetedPoint(), data.GetUser(), damage);
        }
 private void SpawnProjectilesForTargets(AbilityData data, Vector3 spawnPosition)
 {
     foreach (var target in data.GetTargets())
     {
         Health health = target.GetComponent <Health>();
         if (health)
         {
             Projectile projectile = Instantiate(projectileToSpawn);
             projectile.transform.position = spawnPosition;
             projectile.SetTarget(health, data.GetUser(), damage);
         }
     }
 }
        public override void StartEffect(AbilityData data, Action finished)
        {
            Fighter fighter       = data.GetUser().GetComponent <Fighter>();
            Vector3 spawnPosition = fighter.GetHandTransform(isRightHand).transform.position;

            if (useTargetPoint)
            {
                SpawnProjectileForTargetPoint(data, spawnPosition);
            }
            else
            {
                SpawnProjectilesForTargets(data, spawnPosition);
            }
            finished();
        }
Exemple #5
0
 public override void StartEffect(AbilityData data, Action finished)
 {
     foreach (var target in data.GetTargets())
     {
         var health = target.GetComponent <Health>();
         if (health)
         {
             if (healthChange < 0)
             {
                 health.TakeDamage(data.GetUser(), -healthChange);
             }
             else
             {
                 health.Heal(healthChange);
             }
         }
     }
     finished();
 }
        private void SpawnProjectilesForTargets(AbilityData data, Vector3 spawnPosition)
        {
            int count = 0;

            foreach (var target in data.GetTargets())
            {
                if (count >= maxNumberOfTargets)
                {
                    break;
                }

                Health health = target.GetComponent <Health>();
                if (health)
                {
                    Projectile projectile = Instantiate(projectileToSpawn);
                    projectile.transform.position = spawnPosition;
                    projectile.SetTarget(health, data.GetUser(), damage);
                    count++;
                }
            }
        }
 public override void StartEffect(AbilityData data, Action finished)
 {
     data.GetUser().transform.LookAt(data.GetTargetedPoint());
     finished();
 }
Exemple #8
0
 public override void StartTargeting(AbilityData data, Action finished)
 {
     data.SetTargets(new GameObject[] { data.GetUser() });
     data.SetTargetedPoint(data.GetUser().transform.position);
     finished();
 }
Exemple #9
0
        public override void StartTargeting(AbilityData data, Action finished)
        {
            PlayerController playerController = data.GetUser().GetComponent <PlayerController>();

            playerController.StartCoroutine(Targeting(data, playerController, finished));
        }