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); }
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); }
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); } }
public override bool OnRunning(BTTreeRuntimePack _runtimePack) { CatController controller = _runtimePack.GameObject.GetComponent(typeof(CatController)) as CatController; if (controller == null) { return(false); } CatVector3 delta = _runtimePack.GetFromBlackboard(m_deltaName) as CatVector3; if (delta != null) { if (delta.X > 0.0) { controller.m_wantRight = true; } else { controller.m_wantLeft = true; } } return(true); }
protected override bool JudgeCondition(BTTreeRuntimePack _btTree) { string mode = _btTree.GetFromBlackboard("Mode", "") as string; return(mode == m_mode); }