void Awake() { t = gameObject.GetComponent<Transform>(); rb = gameObject.GetComponent<Rigidbody>(); range += Random.Range(-(rangeMargin), rangeMargin); if (Random.value > 0.5f) { strafeDirection = StrafeDirection.LEFT; } }
void Awake() { t = gameObject.GetComponent <Transform>(); rb = gameObject.GetComponent <Rigidbody>(); range += Random.Range(-(rangeMargin), rangeMargin); if (Random.value > 0.5f) { strafeDirection = StrafeDirection.LEFT; } }
/* * FUNCTION: strafe charater right or left * INPUT: "right" OR "left" * OUTPUT: move the character left or right */ private void strafePlayer(StrafeDirection strafeDirection) { if (!mecanimEnabled) { string anim = strafeDirection == StrafeDirection.Strafe_Right ? "right" : "left"; if (isInAir()) { aPlayer[anim].speed = 2; aPlayer.Play(anim); //aPlayer.CrossFade("glide", 0.5); } else if (aPlayer.IsPlaying(anim)) //if strafed while already strafing { aPlayer.Stop(anim); aPlayer[anim].speed = 1.75f; aPlayer.CrossFade(anim, 0.01f); bInStrafe = true; } else { aPlayer[anim].speed = 1.75f; aPlayer.CrossFade(anim, 0.01f); bInStrafe = true; } } //end of if is MechAnim Enabled else { string anim = strafeDirection == StrafeDirection.Strafe_Right ? "StrafeRightAnim" : "StrafeLeftAnim"; if (isInAir()) { aPlayerMecAnim.SetBool(anim, true); } else if (aPlayerMecAnim.GetBool("StrafeRightAnim") || aPlayerMecAnim.GetBool("StrafeLeftAnim")) //if strafed while already strafing { aPlayerMecAnim.SetBool(anim, true); bInStrafe = true; } else { aPlayerMecAnim.SetBool(anim, true); bInStrafe = true; } } } //end of strafe player function
/* * FUNCTION: strafe charater right or left * INPUT: "right" OR "left" * OUTPUT: move the character left or right */ void strafePlayer(StrafeDirection strafeDirection) { if (isInAir()) { aPlayer[strafeDirection.ToString()].speed = 2; aPlayer.Play(strafeDirection.ToString()); } else if (aPlayer.IsPlaying(strafeDirection.ToString())) //if strafed while already strafing { aPlayer.Stop(strafeDirection.ToString()); aPlayer[strafeDirection.ToString()].speed = 1.75f; aPlayer.CrossFade(strafeDirection.ToString(), 0.01f); bInStrafe = true; } else { aPlayer[strafeDirection.ToString()].speed = 1.75f; aPlayer.CrossFade(strafeDirection.ToString(), 0.01f); bInStrafe = true; } }
/* * FUNCTION: strafe charater right or left * INPUT: "right" OR "left" * OUTPUT: move the character left or right */ private void strafePlayer(StrafeDirection strafeDirection) { if (!mecanimEnabled) { string anim = strafeDirection == StrafeDirection.Strafe_Right ? "right" : "left"; if (isInAir()) { aPlayer[anim].speed = 2; aPlayer.Play(anim); //aPlayer.CrossFade("glide", 0.5); } else if (aPlayer.IsPlaying(anim)) //if strafed while already strafing { aPlayer.Stop(anim); aPlayer[anim].speed = 1.75f; aPlayer.CrossFade(anim,0.01f); bInStrafe = true; } else { aPlayer[anim].speed = 1.75f; aPlayer.CrossFade(anim,0.01f); bInStrafe = true; } }//end of if is MechAnim Enabled else { string anim = strafeDirection == StrafeDirection.Strafe_Right ? "StrafeRightAnim" : "StrafeLeftAnim"; if (isInAir()) { aPlayerMecAnim.SetBool(anim, true); } else if (aPlayerMecAnim.GetBool("StrafeRightAnim") || aPlayerMecAnim.GetBool("StrafeLeftAnim")) //if strafed while already strafing { aPlayerMecAnim.SetBool(anim, true); bInStrafe = true; } else { aPlayerMecAnim.SetBool(anim, true); bInStrafe = true; } } }//end of strafe player function