// Update is called once per frame void Update() { // the round text UI element writes Round: and showing the currentRound int value roundText.text = "Round:" + currentRound.ToString(); currentRound = roundIncreaser; // the current Round value equals to the Round Increaser value player = GameObject.FindGameObjectWithTag("Player"); // Find the player DB_PC_Controller PCscript = player.GetComponent <DB_PC_Controller>(); // Find the players Derived Class if (PCscript.imDead == true) // if the PC is dead { StartCoroutine(GameOver()); // Call Gameover } }
protected override void Movement() { // Make local variable for player script DB_PC_Controller playerScript = opponent.GetComponent <DB_PC_Controller>(); if (playerScript.imDead == false) { if (!knockedOut) { if (DB_RefereeAI.NPC_Saw_Elbow == false) { // when the value is 1 or more if (coolDown_fromhit <= 1) { // When the boolean in this class is false if (!beenHit) { // when the transform of this gameObject is still grater than the stopping point value if (Vector3.Distance(transform.position, opponent.position) > Stopping_Distance) { close_to_hit = false; // Let there be speed speed = 1; // Allow the moveDirection to be forward // new movement Vector for NPC for NPC cant use input Vector3 npcmoveDirection = (transform.position += transform.forward * speed * Time.deltaTime); npcmoveDirection = moveDirection; // local vector passes through the orginal base class vector3 base.Movement(); // call the base anim.SetFloat("Speed", speed); } else if (Vector3.Distance(transform.position, opponent.position) < Stopping_Distance) { // Pick a number between 1 and 3 close_to_hit = true; //anim.SetBool("Jabbing", true); } } // when the boolean strikes true else if (beenHit) { // Start the cooldown timer coolDown_fromhit -= Time.deltaTime; // when the cooldown is greater or is 0 if (coolDown_fromhit <= 0) { //anim.SetBool("Jabbing", false); // revert boolean back to orginal state beenHit = false; // reset the value of cooldown coolDown_fromhit = 1; } // turn off that speed if not NPC would be hit but wont stop speed = 0; } } // Make sure the AI moves with the opponets X values transform.position = new Vector3(opponent.position.x, transform.position.y, transform.position.z); } } } }