public PwmLedControllerBase()
        {
            // Try to get the GPIO
            m_gpioController = GpioController.GetDefault();
            if(m_gpioController == null)
            {
                throw new Exception("This device doesn't have a GPIO!");
            }

            // Init the vars
            m_pinMap = new Dictionary<int, GpioPin>();
            m_currentValuesList = new List<double>();

            // Create the controller
            m_controller = new LedController(this, ControlerUpdateType.AllSlots);

            // Create an animator to control the ticks
            m_animator = new TheAnimator(this, 0);
        }
Exemplo n.º 2
0
 public void ResetPlayer()
 {
     if (m_cCharacterController)
     {
         m_cCharacterController.enabled = true;
     }
     m_bIsKicking      = false;
     m_bIsPushed       = false;
     m_bIsStunned      = false;
     m_cState          = CStates.OnFloor;
     m_aAnimator.speed = 1;
     Time.timeScale    = 1;
     if (TheAnimator)
     {
         TheAnimator.SetBool("IsSliding", false);
         TheAnimator.SetBool("IsRunning", false);
         TheAnimator.SetBool("IsStunned", false);
         TheAnimator.SetBool("IsPushing", false);
         TheAnimator.SetBool("IsDiveKick", false);
         TheAnimator.SetBool("IsDancing", false);
         TheAnimator.SetBool("IsWallGrab", false);
     }
 }
        public void ToggleAnimation(bool enableAnmation, bool alwaysPaint, int animationRateMilliseconds = 16)
        {
            lock(animationLock)
            {
                m_animationEnabled = enableAnmation;
                m_alwaysPaint = alwaysPaint;

                if (m_animationEnabled)
                {
                    // Make an animator, this will start the thread
                    m_theAnimator = new TheAnimator(this, animationRateMilliseconds);
                }
                else
                {
                    // Kill the animator, this will stop the thread
                    m_theAnimator.Stop();
                    m_theAnimator = null;
                }
            }
        }