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); }
public override bool OnRunning(BTTreeRuntimePack _runtimePack) { Hunter hunter = _runtimePack.GameObject.GetComponent(typeof(Hunter)) as Hunter; if (hunter != null) { Vector2 hotspot = hunter.LastSpot.GetPointInWorld(); _runtimePack.AddToBlackboard(m_hotspotName, new CatVector3(hotspot.X, hotspot.Y, 0.0f)); } return(false); }
public override bool OnRunning(BTTreeRuntimePack _runtimePack) { _runtimePack.AddToBlackboard("Mode", m_mode); return(false); }