// Use this for initialization void Start() { materialOne = gameObject.GetComponent <Renderer>().material; if (genbuAI == null) { genbuAI = GameObject.Find("Genbu").gameObject.GetComponent <Genbu_AI>(); } }
// Update is called once per frame /* * void Update () { * if (Input.GetKeyDown (KeyCode.O)) { * Launch (); * } * } */ void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("Genbu")) { //FakeGenbu fakeGen = other.transform.GetComponent<FakeGenbu>(); //fakeGen.fakeHealth -= boldDmg; Genbu_AI genAi = other.transform.GetComponent <Genbu_AI>(); genAi.mainHealth -= boldDmg; Destroy(this.gameObject); } }
// Update is called once per frame /* * void Update () { * if (Input.GetKeyDown (KeyCode.K)) { * Explode (); * * } * } * */ public void Explode() { //if the gas pipe is not used up if (!usedUp) { //if hasgas is active then explode and detect colliders for damage if (hasGas) { Collider[] hitColliders = Physics.OverlapSphere(this.transform.position, expRange); int i = 0; while (i < hitColliders.Length) { if (hitColliders[i].CompareTag("Genbu")) { //access genbu AI and damage him //FakeGenbu fakeGen = hitColliders[i].GetComponent<FakeGenbu>(); //fakeGen.fakeHealth -= expDamage; //Instantiate Explosion Genbu_AI genAi = hitColliders[i].GetComponent <Genbu_AI>(); genAi.mainHealth -= expDamage; } //end if i++; } //end while hasGas = false; } //end if usedUp = true; } //end if }
void Update() { numBroken = 0; if (LFrontBroken) { LFrontOil.SetActive(false); LFrontExplosion.SetActive(true); LFrontLeg1.transform.parent = null; LFrontLeg2.transform.parent = null; LFrontLeg3.transform.parent = null; LFrontLeg1.GetComponent <Rigidbody> ().isKinematic = false; LFrontLeg2.GetComponent <Rigidbody> ().isKinematic = false; LFrontLeg3.GetComponent <Rigidbody> ().isKinematic = false; numBroken++; } else if (LFrontDamaged) { LFrontOil.SetActive(true); } if (RFrontBroken) { RFrontOil.SetActive(false); RFrontExplosion.SetActive(true); RFrontLeg1.transform.parent = null; RFrontLeg2.transform.parent = null; RFrontLeg3.transform.parent = null; RFrontLeg1.GetComponent <Rigidbody> ().isKinematic = false; RFrontLeg2.GetComponent <Rigidbody> ().isKinematic = false; RFrontLeg3.GetComponent <Rigidbody> ().isKinematic = false; numBroken++; } else if (RFrontDamaged) { RFrontOil.SetActive(true); } if (LBackBroken) { LBackOil.SetActive(false); LBackExplosion.SetActive(true); LBackLeg1.transform.parent = null; LBackLeg2.transform.parent = null; LBackLeg3.transform.parent = null; LBackLeg1.GetComponent <Rigidbody> ().isKinematic = false; LBackLeg2.GetComponent <Rigidbody> ().isKinematic = false; LBackLeg3.GetComponent <Rigidbody> ().isKinematic = false; numBroken++; } else if (LBackDamaged) { LBackOil.SetActive(true); } if (RBackBroken) { RBackOil.SetActive(false); RBackExplosion.SetActive(true); RBackLeg1.transform.parent = null; RBackLeg2.transform.parent = null; RBackLeg3.transform.parent = null; RBackLeg1.GetComponent <Rigidbody> ().isKinematic = false; RBackLeg2.GetComponent <Rigidbody> ().isKinematic = false; RBackLeg3.GetComponent <Rigidbody> ().isKinematic = false; numBroken++; } else if (RBackDamaged) { RBackOil.SetActive(true); } if (numBroken >= 2) { genbuAnimator.SetBool("isCrawling", true); } if (numBroken >= 4) { Genbu_AI genbuAI = GetComponent <Genbu_AI>(); genbuAI.dead = true; } if (LFrontDamaged && RFrontDamaged && LBackDamaged && RBackDamaged) { if (!voicePlayed) { wolfVoice.ReleaseTheGas(); voicePlayed = true; } } }
void MakeGenbuList(out List <ObjectiveData> ob_list) { ob_list = new List <ObjectiveData> (); //get genbu's AI Genbu_AI _gBoss = GameObject.FindObjectOfType <Genbu_AI>(); //List<ObjectiveData> objectives = new List<ObjectiveData>(); //Bolts objective ObjectiveData boltObjective = new ObjectiveData(); boltObjective.name = "Shield bolts"; // Use this name to find this later boltObjective.description = "Shoot off the bolts holding the armoured plates."; int numofBolts = 0; //to stor the sum of the bolts in the scene //run through the array and give us the sum of the number of bolts on each plate foreach (int bolt in _gBoss.shieldsBlah) { numofBolts += bolt; } boltObjective.total = numofBolts; //Assign boltObjective.currentCount = 0; //Start at zero boltObjective.bIsCompleted = false; //plate objective ObjectiveData plateObjective = new ObjectiveData(); plateObjective.name = "armoured plating"; // Use this name to find this later plateObjective.description = "Armoured plates Destroyed: "; int numofPlates = 0; //to stor the sum of the bolts in the scene //run through the array and give us the sum of the number of plate prent in the scen foreach (GameObject _plate in _gBoss.shields) { numofPlates++; } plateObjective.total = numofPlates; //Assign plateObjective.currentCount = 0; //Start at Zero plateObjective.bIsCompleted = false; //puncture objective ObjectiveData punctureObjective = new ObjectiveData(); punctureObjective.name = "Puncture legs"; // Use this name to find this later punctureObjective.description = "legs damaged: "; punctureObjective.total = 4; //Assign punctureObjective.currentCount = 0; //Start at zero punctureObjective.bIsCompleted = false; // break Legs objective ObjectiveData legObjective = new ObjectiveData(); legObjective.name = "broken legs"; // Use this name to find this later legObjective.description = "Number of legs destroyed: "; legObjective.total = 4; //Assign legObjective.currentCount = 0; //Start at zero legObjective.bIsCompleted = false; //Add our abjectives to the list ob_list.Add(boltObjective); ob_list.Add(plateObjective); ob_list.Add(punctureObjective); ob_list.Add(legObjective); //return ob_list; //Send out the list }