// Makes the bear flip, face left or face right public void OrientBear(BearOrientation o) { var scale = transform.localScale; if (o == BearOrientation.FACE_LEFT) { transform.localScale = new Vector3(Mathf.Abs(scale.x), scale.y, scale.z); } else if (o == BearOrientation.FACE_RIGHT) { transform.localScale = new Vector3(-Mathf.Abs(scale.x), scale.y, scale.z); } else if (o == BearOrientation.FLIP) { transform.localScale = new Vector3(-(scale.x), scale.y, scale.z); } }
// We heard something, or saw something. Let's look in that direction and // search for the player public void AlertBear() { if (/*activity != ALERTED && */ activity != DEAD) { Debug.Log("[!] WARNING!!!"); activity = ALERTED; // Follow the player's sound if (player) { // Stop any patroling coroutines we started StopAllCoroutines(); patroling = false; // Grab bear's orientation BearOrientation facing = GetBearOrientation(); FinishedPatroling(); // Given our new activity, let's decide what to do next } } }