Esempio n. 1
0
 public void Attack(CombatTarget combatTarget)
 {
     //call action scheduler for cancelling action if neccessary
     GetComponent <ActionScheduler>().StartAction(this);
     //store the correct combat target into target variable
     target = combatTarget.GetComponent <Health>();
 }
 public void Attack(CombatTarget combatTarget)
 {
     //calls the script for cancelling the action
     GetComponent <ActionScheduler>().StartAction(this);
     //player will know weather to attack a target or not
     target = combatTarget.GetComponent <Health>();
 }
Esempio n. 3
0
File: Fighter.cs Progetto: iraha/RPG
        public void Attack(CombatTarget combatTarget)
        {
            GetComponent <ActionScheduler>().StartAction(this);
            target = combatTarget.transform;


            print("touch enemy");
        } // Attack
Esempio n. 4
0
        private void OnTriggerExit(Collider other)
        {
            CombatTarget enemy = other.GetComponent <CombatTarget>();

            if (enemy != null)
            {
                collidingTargets.Remove(enemy);
            }
        }
Esempio n. 5
0
 public void TryAttack(CombatTarget combatTarget)
 {
     if (!CanAttack(combatTarget))
     {
         return;
     }
     GetComponent <ActionScheduler>().StartAction(this);
     target = combatTarget.transform;
 }
Esempio n. 6
0
        public bool CanAttack(CombatTarget combatTarget)
        {
            if (combatTarget == null)
            {
                return(false);
            }
            Health targetToTest = combatTarget.GetComponent <Health>();

            return(targetToTest != null && !targetToTest.IsDead());
        }
Esempio n. 7
0
        public void Attack(CombatTarget combatTarget)
        {
            print("Your mother was a hamster and your father smelt of elderberries.");

            //Adding new Actions component
            //https://coding.abel.nu/2013/02/this-in-javascript-vs-c/
            GetComponent <Actions>().StartAction(this);
            //Set enemy to combat target
            target = combatTarget.transform;
        }
Esempio n. 8
0
        public void SetTarget(CombatTarget target, float damage, bool setDirection = false)
        {
            _target = target;
            _damage = damage;
            if (setDirection)
            {
                transform.LookAt(GetAimLocation());
            }

            Destroy(gameObject, maxLifeTime);
        }
        //ignores dead enimies such as their hit box (checks is they are dead)
        public bool CanAttack(CombatTarget combatTarget)
        {
            //if we click on the terrain instead of target return false
            if (combatTarget == null)
            {
                return(false);
            }
            Health targetToTest = combatTarget.GetComponent <Health>();

            return(targetToTest != null && !targetToTest.IsDead());
        }
Esempio n. 10
0
 public void Attack(CombatTarget combatTarget)
 {
     if (combatTarget != null)
     {
         target = combatTarget.transform;
         GetComponent <ActionScheduler>().StartAction(this);
     }
     if (target == null)
     {
         target = null;
     }
 }
 public void Activate(bool shouldActivate)
 {
     foreach (Fighter fighter in fighters)
     {
         CombatTarget target = fighter.GetComponent <CombatTarget>();
         if (target != null)
         {
             target.enabled = shouldActivate;
         }
         fighter.enabled = shouldActivate;
     }
 }
Esempio n. 12
0
        //function to check if the enemy that was hit by raycast is targetable
        public bool CanAttack(CombatTarget combatTarget)
        {
            //if the combatTarget passed in is null then return false (we cannot attack a null object)
            if (combatTarget == null)
            {
                return(false);
            }

            //get Health component from the passed combatTarget
            Health targetToTest = combatTarget.GetComponent <Health>();

            //return true if target is not null AND target is not dead
            return(targetToTest != null && !targetToTest.IsDead());
        }
Esempio n. 13
0
        public void ActivateFightingOnPassiveFighters(bool shouldActivate)
        {
            hasBeenActivated = shouldActivate;

            foreach (Fighter fighter in fighters)
            {
                CombatTarget combatTarget = fighter.GetComponent <CombatTarget>();
                if (combatTarget != null)
                {
                    combatTarget.enabled = hasBeenActivated;
                }
                fighter.enabled = hasBeenActivated;
            }
        }
Esempio n. 14
0
        public bool PlayerAttack()
        {
            RaycastHit[] hits = Physics.RaycastAll(Camera.main.ScreenPointToRay(Input.mousePosition));
            foreach (RaycastHit hit in hits)
            {
                CombatTarget combatTarget = hit.transform.GetComponent <CombatTarget>();
                if (combatTarget == null)
                {
                    continue;
                }

                if (!CanAttack(combatTarget.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButton(0))
                {
                    Attack(combatTarget.gameObject);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 15
0
 public void Attack(CombatTarget target)
 {
     actionSchedular.StartAction(this);
     this.target = target.transform;
 }
Esempio n. 16
0
 public void Attack(CombatTarget combatTarget)
 {
     actionScheduler.StartAction(this);
     target = combatTarget.transform;
 }
Esempio n. 17
0
 public void Attack(CombatTarget combatTarget)
 {
     GetComponent <ActionScheduler>().StartAction(this);
     target = combatTarget.transform;
 }
Esempio n. 18
0
 public void Attack(CombatTarget target)
 {
     print("take that you short");
 }
Esempio n. 19
0
 public void Attack(CombatTarget target)
 {
     Debug.Log("Take that you");
 }
Esempio n. 20
0
 public void Attack(CombatTarget target)
 {
     print("Slapped it in the face!");
 }
Esempio n. 21
0
 public void Attack(CombatTarget combatTarget)
 {
     target = combatTarget.transform;
     print("Screaming combat stuff " + combatTarget.transform.name);
 }
Esempio n. 22
0
 public void Attack(CombatTarget target)
 {
     print("Take this you damn fool!");
 }
Esempio n. 23
0
 public void Attack(CombatTarget target)
 {
     transform.LookAt(target.transform);
     _target = target;
 }
Esempio n. 24
0
 private void StopAttacking()
 {
     _target = null;
     _anim.ResetTrigger(Attack1);
     _anim.SetTrigger(StopAttack);
 }
Esempio n. 25
0
 public void Attack(CombatTarget combatTarget)
 {
     target = combatTarget.transform;
     print("Take you short, squat peasant!");
 }
Esempio n. 26
0
 public void Attack(CombatTarget combatTarget)
 {
     target = combatTarget.transform;
 }
Esempio n. 27
0
 public void Attack(CombatTarget combatTarget)
 {
     actionScheduler.StartAction(this);
     target       = combatTarget.transform;
     targetHealth = target.GetComponent <Health>();
 }
Esempio n. 28
0
 public void Attack(CombatTarget combatTarget)
 {
     GetComponent <ActionScheduler>().StartAction(this);
     target = combatTarget.GetComponent <Health>();
 }
Esempio n. 29
0
 public void Attack(CombatTarget target)
 {
     print("I am attacking you.");
 }
Esempio n. 30
0
        public void LaunchProjectile(Transform rightHand, Transform leftHand, CombatTarget target)
        {
            Projectile projectile = Instantiate(_projectile, (isRightHanded ? rightHand : leftHand).position, Quaternion.identity);

            projectile.SetTarget(target, attackDamage, true);
        }