void OnTriggerEnter(Collider collider) { if (collider.gameObject.name == "Ledge_Grab_Detection") { //Player should be detected now m_startled = true; m_state = CrowState.Takeoff; m_timeTookoff = Time.time; m_takeOffAnimation.Play(); } }
// Use this for initialization void Start() { m_startled = false; m_state = CrowState.Resting; m_startedTakeoff = false; m_animation = this.transform.FindChild("CrowAnims2").GetComponent <Animation>(); m_takeOffAnimation = GetComponent <Animation>(); MathHelp = GetComponent <MathHelpers>(); m_lastPos = this.transform.position; m_audio = GetComponent <AudioSource>(); }
void DoAnimations() { if( m_state == CrowState.Takeoff && m_timeTookoff + TakeoffTime < Time.time ) { m_state = CrowState.Flying; PlayAudio(FlyAway); MeanTimeBetweenIdleAudio = 30.0f; IdleAudioTimeVariance = 10.0f; } if (m_state == CrowState.Resting) { m_currentAnimation = "idle"; if (!m_animation.IsPlaying(m_currentAnimation)) { m_animation.CrossFade(m_currentAnimation, 0.2f); } } else if (m_state == CrowState.Takeoff) { m_currentAnimation = "takeoff"; if (!m_animation.IsPlaying(m_currentAnimation) && !m_startedTakeoff) { m_startedTakeoff = true; m_animation[m_currentAnimation].speed = 0.5f; m_animation.CrossFade(m_currentAnimation, 0.2f); PlayAudio(Liftoff); } else if (!m_animation.IsPlaying(m_currentAnimation)) { m_startedTakeoff = false; m_state = CrowState.Flying; } /* m_currentAnimation = "takeoff"; if (!m_animation.IsPlaying("takeoff")) { m_animation.CrossFade("takeoff", 0.2f); } */ } else if (m_state == CrowState.Flying) { m_currentAnimation = "flight"; if (!m_animation.IsPlaying(m_currentAnimation)) { m_animation.CrossFade(m_currentAnimation, 0.2f); } } }
private void Update() { if (check) { state = CrowState.fly; crow.transform.position = Vector3.MoveTowards(crow.transform.position, new Vector3(crow.transform.position.x + 0.09f, crow.transform.position.y), 1f); } else { state = CrowState.idle; } }
void DoAnimations() { if (m_state == CrowState.Takeoff && m_timeTookoff + TakeoffTime < Time.time) { m_state = CrowState.Flying; PlayAudio(FlyAway); MeanTimeBetweenIdleAudio = 30.0f; IdleAudioTimeVariance = 10.0f; } if (m_state == CrowState.Resting) { m_currentAnimation = "idle"; if (!m_animation.IsPlaying(m_currentAnimation)) { m_animation.CrossFade(m_currentAnimation, 0.2f); } } else if (m_state == CrowState.Takeoff) { m_currentAnimation = "takeoff"; if (!m_animation.IsPlaying(m_currentAnimation) && !m_startedTakeoff) { m_startedTakeoff = true; m_animation[m_currentAnimation].speed = 0.5f; m_animation.CrossFade(m_currentAnimation, 0.2f); PlayAudio(Liftoff); } else if (!m_animation.IsPlaying(m_currentAnimation)) { m_startedTakeoff = false; m_state = CrowState.Flying; } /* * m_currentAnimation = "takeoff"; * if (!m_animation.IsPlaying("takeoff")) * { * m_animation.CrossFade("takeoff", 0.2f); * } */ } else if (m_state == CrowState.Flying) { m_currentAnimation = "flight"; if (!m_animation.IsPlaying(m_currentAnimation)) { m_animation.CrossFade(m_currentAnimation, 0.2f); } } }
// Use this for initialization void Start() { m_startled = false; m_state = CrowState.Resting; m_startedTakeoff = false; m_animation = this.transform.FindChild("CrowAnims2").GetComponent<Animation>(); m_takeOffAnimation = GetComponent<Animation>(); MathHelp = GetComponent<MathHelpers>(); m_lastPos = this.transform.position; m_audio = GetComponent<AudioSource>(); }
void OnTriggerEnter(Collider collider) { if(collider.gameObject.name == "Ledge_Grab_Detection") { //Player should be detected now m_startled = true; m_state = CrowState.Takeoff; m_timeTookoff = Time.time; m_takeOffAnimation.Play(); } }