示例#1
0
        protected override bool JudgeCondition(BTTreeRuntimePack _runTimePack)
        {
            Vector3     currentPosition     = _runTimePack.GameObject.AbsPosition;
            Vector3     distinationPosition = currentPosition;
            GuardBTPack btpack = _runTimePack.GameObject.GetComponent(typeof(GuardBTPack)) as GuardBTPack;

            if (btpack == null)
            {
                return(false);
            }
            if (m_isGuardMode)
            {
                GameObject distinationGameObject = btpack.GameObject.Scene._gameObjectList
                                                   .GetOneGameObjectByName(btpack.GuardPointGameObjectName);
                if (distinationPosition != null)
                {
                    distinationPosition = distinationGameObject.AbsPosition;
                }
            }
            else
            {
                Vector3 hotspot = _runTimePack.GetFromBlackboard(m_hotspotName, "") as CatVector3;
                if (hotspot != null)
                {
                    distinationPosition = hotspot;
                }
            }

            Vector3 delta = distinationPosition - currentPosition;

            _runTimePack.AddToBlackboard(m_outputDestinationNmae, new CatVector3(distinationPosition));
            _runTimePack.AddToBlackboard(m_outputDeltaName, new CatVector3(delta));
            return(delta.X * delta.X > btpack.ArriveDistance * btpack.ArriveDistance);
        }
示例#2
0
        protected override bool JudgeCondition(BTTreeRuntimePack _runtimePack)
        {
            CatInteger suspect = _runtimePack.GetFromBlackboard(m_suspectName, new CatInteger(0))
                                 as CatInteger;

            if (m_isOver)
            {
                GuardBTPack btpack = _runtimePack.GameObject.GetComponent(typeof(GuardBTPack)) as GuardBTPack;
                if (btpack != null)
                {
                    return(suspect > btpack.SuspectThreshold);
                }
                return(false);
            }
            else
            {
                return(suspect <= 0);
            }
        }