void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth2>(); //enemyHealth = player.GetComponent<EnemyHealth>(); //anim = GetComponent<Animator>(); }
private int wayPointIndex; // A counter for the way point array. void Awake() { enemySight = GetComponent <EnemySight2>(); nav = GetComponent <NavMeshAgent>(); player = GameObject.FindGameObjectWithTag(Tags.player).transform; playerHealth = player.GetComponent <PlayerHealth2>(); lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <LastPlayerSighting>(); }
float timer; // Timer for counting up to the next attack. void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth2>(); //anim = GetComponent<Animator>(); }
void Awake() { player = GameObject.FindGameObjectWithTag ("Player").transform; player2 = GameObject.FindGameObjectWithTag ("Player2").transform; playerHealth = player.GetComponent <PlayerHealth> (); player2Health = player2.GetComponent <PlayerHealth2> (); enemyHealth = GetComponent <EnemyHealth> (); nav = GetComponent <NavMeshAgent> (); }
//void start public override void Attached() { reference = this; /*state.Health2 = player2Health; * * //if bolt state to change in Health * state.AddCallback("Health", HealthCallBack); */ }
void Awake() { player = GameObject.FindGameObjectWithTag ("Player"); player2 = GameObject.FindGameObjectWithTag ("Player2"); playerHealth = player.GetComponent <PlayerHealth> (); player2Health = player2.GetComponent <PlayerHealth2> (); enemyHealth = GetComponent <EnemyHealth>(); anim = GetComponent <Animator> (); }
void Start() { GameObject player2Object = GameObject.FindWithTag("Player2"); if (player2Object != null) { player2 = player2Object.GetComponent <PlayerHealth2>(); } if (player2 == null) { Debug.Log("Cannot find 'PlayerHealth2' script"); } }
void Awake() { nav = GetComponent <NavMeshAgent>(); col = GetComponent <SphereCollider>(); anim = GetComponent <Animator>(); lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <LastPlayerSighting>(); player = GameObject.FindGameObjectWithTag(Tags.player); playerAnim = player.GetComponent <Animator>(); playerHealth = player.GetComponent <PlayerHealth2>(); hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>(); personalLastSighting = lastPlayerSighting.resetPosition; previousSighting = lastPlayerSighting.resetPosition; }
void Awake() { currentTime = Time.time; anim = GetComponent <Animator> (); anim.SetFloat("shrink", 0); TopLeft.SetActive(false); BotRight.SetActive(false); check = false; fallingP1 = false; fallingP2 = false; player1Movementscript = Player1.GetComponent <PlayerMovement> (); player2Movementscript = Player2.GetComponent <PlayerMovement> (); player1Healthscript = Player1.GetComponent <PlayerHealth1> (); player2Healthscript = Player2.GetComponent <PlayerHealth2> (); }
void Awake() { anim = GetComponent <Animator>(); laserShotLine = GetComponentInChildren <LineRenderer>(); laserShotLight = laserShotLine.gameObject.GetComponent <Light>(); col = GetComponent <SphereCollider>(); player = GameObject.FindGameObjectWithTag(Tags.player).transform; playerHealth = player.gameObject.GetComponent <PlayerHealth2>(); hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>(); // The line renderer and light are off to start. laserShotLine.enabled = false; laserShotLight.intensity = 0f; scaledDamage = maximumDamage - minimumDamage; }
void Shoot() { shooting = true; // The fractional distance from the player, 1 is next to the player, 0 is the player is at the extent of the sphere collider. float fractionalDistance = (col.radius - Vector3.Distance(transform.position, player.position)) / col.radius; // The damage is the scaled damage, scaled by the fractional distance, plus the minimum damage. float damage = scaledDamage * fractionalDistance + minimumDamage; shootRay.origin = laserShotLine.transform.position; shootRay.direction = player.transform.position - transform.position; laserShotLine.SetPosition(0, laserShotLine.transform.position); if (Physics.Raycast(shootRay, out shootHit, range)) { PlayerHealth2 playerHealth = shootHit.collider.GetComponent <PlayerHealth2> (); if (playerHealth != null) { playerHealth.TakeDamage(damage); } laserShotLine.SetPosition(1, shootHit.point); } else { laserShotLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } //laserShotLine.SetPosition(1, player.position + Vector3.up * 1.5f); laserShotLine.enabled = true; laserShotLight.intensity = flashIntensity; AudioSource.PlayClipAtPoint(shotClip, laserShotLight.transform.position); }
void Awake() { playerHealth = player.GetComponent<PlayerHealth2>(); }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth2>(); }