Esempio n. 1
0
        public override bool OnRunning(BTTreeRuntimePack _runtimePack)
        {
            CatInteger suspect = _runtimePack.GetFromBlackboard(m_suspectName, new CatInteger(0))
                                 as CatInteger;

            suspect.SetValue(suspect + m_increament);
            _runtimePack.AddToBlackboard(m_suspectName, suspect);
            return(true);
        }
Esempio n. 2
0
        private void UpdateValue()
        {
            Type type = refValue.GetType();

            if (type == typeof(CatVector3))
            {
                // delta
                CatVector3 _fromValue = (CatVector3)fromValue;
                CatVector3 _toValue   = (CatVector3)toValue;
                CatVector3 delta      = _toValue - _fromValue;
                // set value
                CatVector3 value   = (CatVector3)refValue;
                float      percent = (float)curTick / totalTick;
                value.SetValue(_fromValue.GetValue() + delta.GetValue() * GetCurveValue(percent));
            }
            else if (type == typeof(CatVector2))
            {
                //delta
                CatVector2 _fromValue = (CatVector2)fromValue;
                CatVector2 _toValue   = (CatVector2)toValue;
                CatVector2 delta      = _toValue - _fromValue;
                // set value
                CatVector2 value   = (CatVector2)refValue;
                float      percent = (float)curTick / totalTick;
                value.SetValue(_fromValue.GetValue() + delta.GetValue() * GetCurveValue(percent));
            }
            else if (type == typeof(CatFloat))
            {
                // delta
                float _fromValue = ((CatFloat)fromValue);
                float _toValue   = ((CatFloat)toValue);
                float delta      = _toValue - _fromValue;
                // set value
                CatFloat value = (CatFloat)refValue;
                value.SetValue(_fromValue + delta * GetCurveValue((float)curTick / totalTick));
            }
            else if (type == typeof(CatInteger))
            {
                // delta
                int _fromValue = ((CatInteger)fromValue);
                int _toValue   = ((CatInteger)toValue);
                int delta      = _toValue - _fromValue;
                // set value
                CatInteger value = (CatInteger)refValue;
                value.SetValue(_fromValue + (int)(delta * GetCurveValue((float)curTick / totalTick)));
            }
        }
Esempio n. 3
0
//         public override CatComponent CloneComponent(GameObject gameObject)
//         {
//             Animator animator = new Animator(gameObject);
//             animator.AnimationName = m_currentAnimationName;
//             return animator;
//         }

        // needs: quadRender, quadRender.Animation, Model,

        public override void Initialize(Scene scene)
        {
            base.Initialize(scene);

            // configuration
            ModelComponent modelComponent = (ModelComponent)m_gameObject.GetComponent(typeof(ModelComponent).Name);

            if (modelComponent == null || modelComponent.Model == null)
            {
                return;
            }
            Animation animation = modelComponent.Model.GetAnimation();

            m_timeLastFrame = 0;
            m_isPlaying.SetValue(animation.m_isAutoPlay);
            m_currentIndex = 0;
            if (m_currentAnimationName == null || m_currentAnimationName == "")
            {
                m_currentAnimationName = animation.m_defaultAnimationClipName;
            }
            m_isPong = false;
            m_millionSecondPreFrame.SetValue(animation.m_millionSecondPerFrame);
        }