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>(); }
public void Attack(CombatTarget combatTarget) { GetComponent <ActionScheduler>().StartAction(this); target = combatTarget.transform; print("touch enemy"); } // Attack
private void OnTriggerExit(Collider other) { CombatTarget enemy = other.GetComponent <CombatTarget>(); if (enemy != null) { collidingTargets.Remove(enemy); } }
public void TryAttack(CombatTarget combatTarget) { if (!CanAttack(combatTarget)) { return; } GetComponent <ActionScheduler>().StartAction(this); target = combatTarget.transform; }
public bool CanAttack(CombatTarget combatTarget) { if (combatTarget == null) { return(false); } Health targetToTest = combatTarget.GetComponent <Health>(); return(targetToTest != null && !targetToTest.IsDead()); }
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; }
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()); }
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; } }
//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()); }
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; } }
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); }
public void Attack(CombatTarget target) { actionSchedular.StartAction(this); this.target = target.transform; }
public void Attack(CombatTarget combatTarget) { actionScheduler.StartAction(this); target = combatTarget.transform; }
public void Attack(CombatTarget combatTarget) { GetComponent <ActionScheduler>().StartAction(this); target = combatTarget.transform; }
public void Attack(CombatTarget target) { print("take that you short"); }
public void Attack(CombatTarget target) { Debug.Log("Take that you"); }
public void Attack(CombatTarget target) { print("Slapped it in the face!"); }
public void Attack(CombatTarget combatTarget) { target = combatTarget.transform; print("Screaming combat stuff " + combatTarget.transform.name); }
public void Attack(CombatTarget target) { print("Take this you damn fool!"); }
public void Attack(CombatTarget target) { transform.LookAt(target.transform); _target = target; }
private void StopAttacking() { _target = null; _anim.ResetTrigger(Attack1); _anim.SetTrigger(StopAttack); }
public void Attack(CombatTarget combatTarget) { target = combatTarget.transform; print("Take you short, squat peasant!"); }
public void Attack(CombatTarget combatTarget) { target = combatTarget.transform; }
public void Attack(CombatTarget combatTarget) { actionScheduler.StartAction(this); target = combatTarget.transform; targetHealth = target.GetComponent <Health>(); }
public void Attack(CombatTarget combatTarget) { GetComponent <ActionScheduler>().StartAction(this); target = combatTarget.GetComponent <Health>(); }
public void Attack(CombatTarget target) { print("I am attacking you."); }
public void LaunchProjectile(Transform rightHand, Transform leftHand, CombatTarget target) { Projectile projectile = Instantiate(_projectile, (isRightHanded ? rightHand : leftHand).position, Quaternion.identity); projectile.SetTarget(target, attackDamage, true); }