public override bool perform(GameObject agent) { if (startTime == 0) { startTime = Time.time; goapEnemyAI.AnimatorBool("Boxing", true); goapEnemyAI.AnimatorFloat("vely", 0f); goapEnemyAI.AnimatorFloat("velx", 0f); } if (Time.time - startTime > waitTime) { // Debug.Log(string.Format("<color=blue>Attacking:</color> waited {0} waitTime {1} Opp name {2}", (Time.time - startTime), waitTime , agent.name)); if (opponentTarget.Health > 0) { // look at player RaycastHit hit; // Does the ray intersect any objects excluding the player layer if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, maxDistance, layerMask)) { Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit.distance, Color.yellow); //Debug.Log(string.Format( "<color=blue>Attacking:</color> Did Hit {0} with damage {1}",opponentTarget.Health, goapEnemyAI.backpack.weopon.damage )); opponentTarget.Health -= goapEnemyAI.backpack.weopon.damage; startTime = 0; // hitOpponent = true; } else { Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 1000, Color.white); //Debug.Log("Did not Hit"); transform.LookAt(target.transform); } } else { hitOpponent = true; opponentTarget.IamUnderFire = null; goapEnemyAI.AnimatorBool("Boxing", false); // startTime = 0; return(false); //dead enemy } } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { startTime = Time.time; goapEnemyAI.AnimatorBool("Dodge", false); goapEnemyAI.AnimatorBool("Boxing", false); } if (Time.time - startTime > waitTime) { gotCover = true; opponentMe.Health += 10; } return(true); }
public override bool perform(GameObject agent) { if (startTime == 0) { startTime = Time.time; goapEnemyAI.AnimatorBool("Dodge", true); goapEnemyAI.AnimatorBool("Boxing", false); } if (Time.time - startTime > waitTime) { Debug.Log("<color=orange>Dodged!!!</color>" + agent.name); // goapEnemyAI.AnimatorTrigger("Dodge"); // goapEnemyAI.AnimatorBool("Dodge", false); goapEnemyAI.AnimatorBool("Dodge", false); dodged = true; } return(true); }