public void SetTarget(Health1 target, GameObject instigator, float damage) { this.target = target; this.damage = damage; this.instigator = instigator; Destroy(gameObject, maxLifeTime); }
private void Awake() { fighter = GetComponent <Fighter>(); health = GetComponent <Health1>(); mover = GetComponent <Mover>(); player = GameObject.FindWithTag("Player"); guardPosition = new LazyValue <Vector3>(GetGuardPosition); }
void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <Health1> (); enemyHealth = GetComponent <Health>(); anim = GetComponent <Animator> (); audio = GetComponent <AudioSource> (); }
public bool CanAttack(GameObject combatTarget) { if (combatTarget == null) { return(false); } Health1 targetToTest = combatTarget.GetComponent <Health1>(); return(targetToTest != null && !targetToTest.IsDead()); }
private void Start() { body = GetComponent <Rigidbody2D>(); pHealth = (Health1)FindObjectOfType(typeof(Health1)); hBar = (HealthBar1)FindObjectOfType(typeof(HealthBar1)); transform.position = spawnPoint.transform.position; l11 = GameObject.FindGameObjectWithTag("L11"); l21 = GameObject.FindGameObjectWithTag("L21"); l31 = GameObject.FindGameObjectWithTag("L31"); }
private void Update() { if (fighter.GetTarget() == null) { GetComponent <Text>().text = "N/A"; return; } Health1 health = fighter.GetTarget(); GetComponent <Text>().text = String.Format("{0:0}/{1:0}", health.GetHealthPoints(), health.GetMaxHealthPoints()); }
void Awake() { // Set up the references. player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent <Health1> (); enemyHealth = GetComponent <Health> (); nav = GetComponent <NavMeshAgent> (); anim = GetComponent <Animator> (); }
void OnTriggerEnter(Collider vOther) { Health1 tH = vOther.GetComponent <Health1> (); if (tH != null) { Destroy(gameObject); tH.TakeDamage(15); // CmdHit (tNID.netId); } Enemy tE = vOther.GetComponent <Enemy> (); if (tE != null) { tE.NewColour(Random.ColorHSV()); } }
private void Awake() { navMeshAgent = GetComponent <NavMeshAgent>(); health = GetComponent <Health1>(); }
public void Cancel() { StopAttack(); target = null; GetComponent <Mover>().Cancel(); }
public void Attack(GameObject combatTarget) { GetComponent <ActionScheduler>().StartAction(this); target = combatTarget.GetComponent <Health1>(); }
public void LaunchProjectile(Transform rightHand, Transform leftHand, Health1 target, GameObject instigator, float calculatedDamage) { Projectile projectileInstance = Instantiate(projectile, GetTransform(rightHand, leftHand).position, Quaternion.identity); projectileInstance.SetTarget(target, instigator, calculatedDamage); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player2"); pHealth = (Health1)FindObjectOfType(typeof(Health1)); hBar = (HealthBar1)FindObjectOfType(typeof(HealthBar1)); }
private void Awake() { health = GetComponent <Health1>(); }