// Update is called once per frame void Update() { switch( m_State ) { case SensorDamperState.UnActive : m_State = SensorDamperState.Damping ; break ; case SensorDamperState.Damping : DampTheSensorEffect() ; if( true == m_AffectTimer.IsCountDownToZero() ) { m_State = SensorDamperState.ClearEffect ; } break ; case SensorDamperState.ClearEffect : ClearSensorDamper() ; break ; case SensorDamperState.End : if( this.gameObject.name == ConstName.MainCharacterObjectName ) AddMessage() ; Destroy( this ) ; break ; } }
private void ClearSensorDamper() { UnitData unitData = this.gameObject.GetComponent<UnitData>() ; if( null == unitData ) return ; UnitComponentData sensor = unitData.GetSensorComponent() ; if( null == sensor ) return ; if( sensor.m_Effect.now < sensor.m_Effect.max ) { sensor.m_Effect.now += ( m_ClearSpeed * Time.deltaTime ) ; } else { m_State = SensorDamperState.End ; } }