// Use this for initialization public void Start() { Instance = this; playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <TitanPlayerHealth>(); hitPoints = GetComponent <TitanNPCHealth>().currentHealth; moveRate = GetComponent <AI>().randomSpeed; }
float timer; // Timer for counting up to the next attack. void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <TitanPlayerHealth>(); enemyHealth = GetComponent <TitanNPCHealth>(); anim = GetComponent <Animator>(); }
bool damaged; // True when the player gets damaged. void Awake() { // Setting up the references. //anim = GetComponent<Animator>(); titanPlayerHealth = this; playerAudio = GetComponent <AudioSource>(); //playerMovement = GetComponent<PlayerMovement>(); //playerShooting = GetComponentInChildren<PlayerShooting>(); // Set the initial health of the player. currentHealth = startingHealth; }
private void Awake() { //Initialize State Machine Engine Initialize <States>(); //Change to our first state ChangeState(States.Floating); playerHealth = GetComponent <TitanPlayerHealth>(); defend = transform.FindChild("Sonar_Ping_Defense_Attack").gameObject; scan = transform.FindChild("Long_Range_Scan").gameObject; radar = transform.FindChild("Sonar_Radar_Scan").gameObject; //anim = GetComponentInChildren<Animator>(); myRigidbody = GetComponent <Rigidbody>() as Rigidbody; Instance = this; myTransform = transform; myRigidbody.freezeRotation = true; myRigidbody.mass = 10; }