public void BlackBoardReadTypeObjectNoEx() { var bb = new BlackBoard(); bb.SetValue("foo", 10f); Assert.That(() => bb.ReadValue <object>("foo"), Throws.Nothing); }
public void BlackBoardReadUnexistingKeyEx() { var bb = new BlackBoard(); bb.SetValue("foo", 10f); Assert.That(() => bb.ReadValue <float>("bar"), Throws.Exception.TypeOf <KeyNotFoundException>()); }
public override void LoadContent() { base.LoadContent(); _grid = BlackBoard.GetEntry <Grid>("Grid"); _terrainLayer = BlackBoard.GetEntry <TerrainLayer>("TerrainLayer"); _counters[0] = _grid.Size; }
public override IEnumerator RunTest() { m_Client = new TopicClient(); m_BlackBoard = new BlackBoard(m_Client); if (m_Client.IsActive) { m_Client.Disconnect(); while (m_Client.IsActive) { yield return(null); } } m_Client.StateChangedEvent += OnStateChanged; m_Client.Connect(); while (!m_bSubscribeTested) { yield return(null); } Log.Debug("TestBlackBoard", "Tested Subscription now disconnecting"); m_Client.Disconnect(); while (!m_ConnectionClosed) { yield return(null); } m_Client.StateChangedEvent -= OnStateChanged; yield break; }
public override void OnEnter(BlackBoard blackboard) { LogEnter(); RaiseEvent(E_EntityInTrigger.SKILL_RELEASE, null); Finish(); }
public override bool checkProceduralPrecondition(GameObject agent, BlackBoard bb) { // find the nearest rock that we can mine IronRockComponent[] rocks = bb.GetData("ironRock") as IronRockComponent[]; IronRockComponent closest = null; float closestDist = 0; foreach (IronRockComponent rock in rocks) { if (closest == null) { // first one, so choose it for now closest = rock; closestDist = (rock.gameObject.transform.position - agent.transform.position).magnitude; } else { // is this one closer than the last? float dist = (rock.gameObject.transform.position - agent.transform.position).magnitude; if (dist < closestDist) { // we found a closer one, use it closest = rock; closestDist = dist; } } } targetRock = closest; target = targetRock.gameObject; return(closest != null); }
/* public override void MakeSatisfied(WorldState worldState) * { * worldState.SetWSProperty(WorldStatePropKey.TARGET_ATTACKED, true); * }*/ public override void CalcWeight(WorldState worldState, BlackBoard blackBoard) { Weight = 0; if (blackBoard.desiredTarget == null) { return; } if (blackBoard.Vigor < blackBoard.vigorAttackCost) { return; } if (blackBoard.InCombatRange == false) { return; } if (blackBoard.maxRage == 0) { return; } float attackValue = blackBoard.Rage / blackBoard.maxRage; if (attackValue < 0.25f) { return; } Weight = blackBoard.GOAP_AttackTargetRelevancy * attackValue; }
public override void LoadContent() { _content = BlackBoard.GetEntry <ContentManager>("ContentManager"); _graphicsDevice = BlackBoard.GetEntry <GraphicsDevice>("GraphicsDevice"); _camera = BlackBoard.GetEntry <CameraComponent>("Camera"); _map = BlackBoard.GetEntry <Map>("Map"); _texture = _content.Load <Texture2D>("Images/OryxEnv"); _effect = new BasicEffect(_graphicsDevice); _effect.TextureEnabled = true; _effect.Texture = _texture; _quads = new List <QuadShape>(); for (int z = 0; z < _map.Height; z++) { for (int x = 0; x < _map.Width; x++) { Vector3 quadOrigin = new Vector3(x, 0, z); TextureFrame textureFrame = new TextureFrame(0.375f, 0, 0.0625f, 0.0625f); QuadShape quad = new QuadShape(quadOrigin, Vector3.Up, Vector3.Forward, textureFrame); _quads.Add(quad); } } }
// Token: 0x0600145C RID: 5212 RVA: 0x00021728 File Offset: 0x00020728 protected override void OnMessage(OnFinalStrike message) { foreach (InternalBlackboardSlot internalBlackboardSlot in this.slots) { BlackBoard.Get().Change(internalBlackboardSlot.Channel, internalBlackboardSlot.BlackboardKey); } }
public override void OnUpdate(float dt, BlackBoard blackboard) { //SkillLog.Log("位置偏移-->OnUpdate:[{0}]", TimeModule.FrameCount); _curr_frame++; // 有问题的 _entity.EntityController._trans.position = Vector3.Lerp(_sourcePos, _targetPos, _curr_frame * 1.0f / _frameLength); }
void Awake() { _blackBoard = transform.GetComponent <BlackBoard>(); // 一定要按枚举顺序加入, 以便于按枚举值索引 AnimFsmStateIdle idleState = new AnimFsmStateIdle(GetComponent <Agent>()); AddState(idleState); AnimFsmStateGoTo gotoState = new AnimFsmStateGoTo(GetComponent <Agent>()); AddState(gotoState); AnimFsmStateCombatMove combatMoveState = new AnimFsmStateCombatMove(GetComponent <Agent>()); AddState(combatMoveState); AnimFsmStateAttackMelee attackMeleeState = new AnimFsmStateAttackMelee(GetComponent <Agent>()); AddState(attackMeleeState); AnimFsmStateInjury injuryState = new AnimFsmStateInjury(GetComponent <Agent>()); AddState(injuryState); AnimFsmStateDeath deathState = new AnimFsmStateDeath(GetComponent <Agent>()); AddState(deathState); AnimFsmStateKnockdown knowdownState = new AnimFsmStateKnockdown(GetComponent <Agent>()); AddState(knowdownState); CurState = DefState = idleState; }
// Use this for initialization void Start() { if (deviceNb == 0) { deviceNb = 1; } myBlackBoardScript = GetComponent <BlackBoard>(); //boardTexture = (Texture2D)this.GetComponent<Renderer>().material.mainTexture; boardTexture = myBlackBoardScript.boardTexture; boardPixels = boardTexture.GetPixels(); originalBoardPixels = boardTexture.GetPixels(); /* int i = 0; * float darkR = 0.1f; * float darkG = 0.2f; * float darkB = 0.1f; * for (int y=0; y<boardTexture.height; y++) * { * for (int x=0; x<boardTexture.width; x++) * { * boardPixels[i] = new Color(boardPixels[i].r * darkR, boardPixels[i].g * darkG, boardPixels[i].b * darkB); * i++; * } * }*/ boardTexture.SetPixels(boardPixels); boardTexture.Apply(); changePenColor(penColorNum); }
public override void Process(Entity entity) { var player = entity.GetComponent <PlayerComponent>(); var input = BlackBoard.GetEntry <Input>("Input"); // if (!input.PlayerInput.ContainsKey(player.Id)) // return; ConcurrentQueue <JToken> commands = null; if (input.PlayerInput.TryGetValue(player.Id, out commands)) { //var commands = input.PlayerInput[player.Id]; JToken command; while (commands.TryDequeue(out command)) { var type = command["type"].Value <string>(); switch (type) { case "move": ProcessMove(entity, command); break; case "move_stop": ProcessMoveStop(entity, command); break; default: // send type error break; } //Process } } }
void State_Ground(BlackBoard bb) { float dt = Time.deltaTime; animation[baseClipsIds.run].normalizedSpeed = bb.movementSpeed / dt * bb.runSpeedFactor; animation[baseClipsIds.walk].normalizedSpeed = bb.movementSpeed / dt * bb.walkSpeedFactor; float normalizedSpeed = bb.movementSpeed / dt / MAX_VELOCITY; float idleWeight = idleBlendtreeCurve.Evaluate(normalizedSpeed); float runWeight = runBlendtreeCurve.Evaluate(normalizedSpeed); float walkWeight = walkBlendtreeCurve.Evaluate(normalizedSpeed); //NOTE(Brian): Normalize weights float weightSum = idleWeight + runWeight + walkWeight; idleWeight /= weightSum; runWeight /= weightSum; walkWeight /= weightSum; animation.Blend(baseClipsIds.idle, idleWeight, GROUND_BLENDTREE_TRANSITION_TIME); animation.Blend(baseClipsIds.run, runWeight, GROUND_BLENDTREE_TRANSITION_TIME); animation.Blend(baseClipsIds.walk, walkWeight, GROUND_BLENDTREE_TRANSITION_TIME); if (!bb.isGrounded) { currentState = State_Air; Update(); } }
public override void OnEnter(BlackBoard blackBoard) { base.OnEnter(blackBoard); blackBoard.navMeshAgent.speed = blackBoard.deer.walkSpeed; blackBoard.deer.SetAnimation("isWalking", true); GetRandomWanderPoint(); }
/// <summary> /// 执行 /// 如果操作成功执行则返回True,否则返回false, /// 如果发生了什么事,它就再也无法执行了。 在这种情况下 /// 行动队列应清除,无法达到目标。</summary> /// <param name="agent"></param> /// <param name="bb"></param> /// <returns></returns> /// <exception cref="System.NotImplementedException"></exception> public override bool Perform(GameObject agent, BlackBoard bb) { if (startTime == 0) { startTime = Time.time; } if (Time.time - startTime > workDuration) { // Backpack backpack = (Backpack)bb.GetData("backpack"); //增加背包中的数量 backpack.stoneNum += 5; //完成 isComplete = true; ToolComponent tool = backpack.tool.GetComponent <ToolComponent>(); //减少工具耐久度 tool.use(0.34f); //耐久度小于等于0销毁当前工具 if (tool.destroyed()) { Destroy(backpack.tool); backpack.tool = null; } } return(true); }
public void OnDestroy() { // Purge blackboard BlackBoard.Clear(name); // unsub everything in the sub list if (subscriptions != null && subscriptions.Count > 0) { foreach (Subscription sub in subscriptions) { if (sub != null) { Dispatcher.UnSubscribe(sub); } } } if (timers != null && timers.Count > 0) { foreach (Timer timer in timers) { timer.Remove(); } } }
public override void Process(Entity entity) { Entity player = (Entity)BlackBoard.GetEntry("Player"); CollisionBox playerBox = player.GetComponent <CollisionBox>(); Position playerPosition = player.GetComponent <Position>(); Rectangle playerRectangle = new Rectangle( (int)playerPosition.X + playerBox.OffsetX, (int)playerPosition.Y + playerBox.OffsetY, playerBox.Width, playerBox.Height); CollisionBox enemyBox = entity.GetComponent <CollisionBox>(); Position enemyPosition = entity.GetComponent <Position>(); Rectangle enemyRectangle = new Rectangle( (int)enemyPosition.X + enemyBox.OffsetX, (int)enemyPosition.Y + enemyBox.OffsetY, enemyBox.Width, enemyBox.Height); Script script = entity.GetComponent <Script>(); var type = playerRectangle.GetCollisionType(enemyRectangle); if (type == CollisionType.None || string.IsNullOrWhiteSpace(script.FilePath)) { return; } _scriptManager.QueueScript(script.FilePath, entity, "OnTouch"); }
void State_Ground(BlackBoard bb) { if (bb.deltaTime <= 0) { Debug.LogError("deltaTime should be > 0", gameObject); return; } animation[baseClipsIds.run].normalizedSpeed = bb.movementSpeed / bb.deltaTime * bb.runSpeedFactor; animation[baseClipsIds.walk].normalizedSpeed = bb.movementSpeed / bb.deltaTime * bb.walkSpeedFactor; float movementSpeed = bb.movementSpeed / bb.deltaTime; if (movementSpeed > runMinSpeed) { animation.CrossFade(baseClipsIds.run, RUN_TRANSITION_TIME); } else if (movementSpeed > walkMinSpeed) { animation.CrossFade(baseClipsIds.walk, WALK_TRANSITION_TIME); } else { animation.CrossFade(baseClipsIds.idle, IDLE_TRANSITION_TIME); } if (!bb.isGrounded) { currentState = State_Air; Update(bb.deltaTime); } }
public void BlackBoardReadFloatIntoIntEx() { var bb = new BlackBoard(); bb.SetValue("foo", -50f); Assert.That(() => bb.ReadValue <int>("foo"), Throws.Exception.TypeOf <InvalidCastException>()); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { moves = animator.GetComponent <Moves>(); blackboard = animator.GetComponent <BlackBoard>(); animator.GetComponent <UnityEngine.AI.NavMeshAgent>().speed = 2f; moves.Seek(blackboard.treasure.transform.position); }
public void OnInitialize(BlackBoard bb) { foreach (var utility in utilities) { utility.OnInitialize(bb); } }
public Dictionary <int, IBehaviorNode> BuildBranchMap(BlackBoard blackBoard) { // build branch var branches = new Dictionary <int, IBehaviorNode>(); var symbolTable = CreateSymbolTable(); while (symbolTable.entityMap.Keys.Count > 0) { Console.WriteLine("Loop: " + symbolTable.entityMap.Keys.Count); int affect = 0; foreach (var key in symbolTable.entityMap.Keys) { Console.WriteLine(key + ": " + symbolTable.prerequisiteMap[key]); if (symbolTable.prerequisiteMap[key] == 0) { Console.WriteLine(key + " update."); var node = CreateNode(symbolTable.entityMap[key], blackBoard, branches); branches.Add(node.GetHashCode(), node); foreach (var edge in symbolTable.entryOrderMap[key]) { Console.WriteLine(key + " created => sub prerequisite of " + edge); symbolTable.prerequisiteMap[edge] -= 1; } symbolTable.entityMap.Remove(key); affect += 1; } } if (affect == 0) { throw new InvalidOperationException("Build "); } } return(branches); }
private static void TestSelectorOfSequences() { var bb = new BlackBoard(); var main = new SelectorTask("Main Selector"); var s1 = new SequenceTask("Sequence 1"); var s2 = new SequenceTask("Sequence 2"); var s3 = new SequenceTask("Sequence 3"); s1.AddChildTask(new TestSuccessLeaf("1")); s1.AddChildTask(new TestSuccessLeaf("2")); s1.AddChildTask(new AlwaysTrueTask(new TestFailureLeaf("3"))); s2.AddChildTask(new TestSuccessLeaf("1")); s2.AddChildTask(new TestFailureLeaf("2")); s2.AddChildTask(new TestSuccessLeaf("3")); s3.AddChildTask(new TestSuccessLeaf("1")); s3.AddChildTask(new TestSuccessLeaf("2")); s3.AddChildTask(new TestSuccessLeaf("3")); main.AddChildTask(s1); main.AddChildTask(s2); main.AddChildTask(s3); SetTimer(main, bb); }
public override bool Perform(GameObject agent, BlackBoard bb) { if (startTime == 0) { startTime = Time.time; } if (Time.time - startTime > miningDuration) { targetWolf.WolfNum--; // finished hunt BackpackComponent backpack = (BackpackComponent)agent.GetComponent(typeof(BackpackComponent)); backpack.numMeat += 3; finishHunt = true; if (backpack.tool == null) { ToolComponent tool = backpack.tool.GetComponent(typeof(ToolComponent)) as ToolComponent; tool.use(0.5f); if (tool.destroyed()) { Destroy(backpack.tool); backpack.tool = null; } } } return(true); }
/* public override void MakeSatisfied(WorldState worldState) * { * worldState.SetWSProperty(WorldStatePropKey.EVENT, EventTypes.NONE); * }*/ public override void CalcWeight(WorldState worldState, BlackBoard blackBoard) { Weight = 0; WorldStateProp prop = worldState.GetWSProperty(WorldStatePropKey.EVENT); if (prop != null) { /*if (prop.GetEvent() == EventTypes.HIT || prop.GetEvent() == EventTypes.KNOCKDOWN || prop.GetEvent() == EventTypes.DEAD) * { * Weight = blackBoard.GOAP_ReactToDamageRelevancy; * }*/ switch (prop.GetEvent()) { case EventTypes.HIT: Weight = blackBoard.GOAP_INJURY; break; case EventTypes.DEAD: Weight = blackBoard.GOAP_DEATH; break; case EventTypes.KNOCKDOWN: Weight = blackBoard.GOAP_KNOCKDOWN; break; default: break; } } }
public override void LoadContent() { base.LoadContent(); _grid = BlackBoard.GetEntry <Grid>("Grid"); byte[,] calculateGrid = CalculateGrid(_grid); _pathFinder = new PathFinder(calculateGrid); }
public Sequencer <BlackBoard> BuildTree(BlackBoard blackboard) { Sequencer <BlackBoard> rootNode = new Sequencer <BlackBoard>(blackboard); Iddle iddleNode = new Iddle(blackboard); rootNode.AddChild(iddleNode); Sequencer <BlackBoard> mining = new Sequencer <BlackBoard>(blackboard); rootNode.AddChild(mining); GoToMine goMineNode = new GoToMine(blackboard); Mine mineNode = new Mine(blackboard); mining.AddChild(goMineNode); mining.AddChild(mineNode); Sequencer <BlackBoard> depositing = new Sequencer <BlackBoard>(blackboard); rootNode.AddChild(depositing); GoHome goHomeNode = new GoHome(blackboard); Deposit depoNode = new Deposit(blackboard); depositing.AddChild(goHomeNode); depositing.AddChild(depoNode); return(rootNode); }
public MoveAhead(BlackBoard blackBoard, int _movePixels, bool _set = false, bool _resetsCollission = false) { this.blackBoard = blackBoard; moveDistance = _movePixels; set = _set; resetsCollission = _resetsCollission; }
public void Update(int currFrame, BlackBoard bb) { if (currFrame < _sFrame) { return; } if (currFrame > _eFrame) { return; } if (currFrame == _sFrame) { OnEnter(bb); } if (currFrame >= _sFrame) { OnUpdate(bb); } if (currFrame == _eFrame) { OnExit(bb); } }
void Awake() { goalIndex = 0; blackBoard = BlackBoard.Instance; planner = new Planner(); goals = new List<WorldState>(); buildingGroup = new GameObject(); }
// Use this for initialization void Start() { BlkBrdMngr = GetComponent<BlkBrdMngr>(); TotalBulletsNear = 0; AreBulletsNear = false; // Gets Updated Blackboard ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; }
// Update is called once per frame void Update() { // Gets updated Black Board. ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; // If Specialist is active, act. if (ReadBlackBoard.ActSpec == ActionSpecialists.AttackSpec) AttackLogic(); }
// Update is called once per frame void Update() { // Gets updated Black Board. ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; // Decides which specialist gets to act. SelectPassiveSpec(); SelectActiveSpec(); }
// Use this for initialization void Start() { // Component References BlkBrdMngr = GetComponent<BlkBrdMngr>(); // Starting Conditions: ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; BlkBrdMngr.WriteBlckBrd.BossBhvr = BossBehavior.Agressive; }
// Update is called once per frame void Update() { // Update Reac Black Board. ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; // If Specialist is active, act. if (ReadBlackBoard.PasSpec == PassiveSpecialists.BehaviorSpec) BehaviorLogic(); }
// Use this for initialization void Start () { bb = new BlackBoard(); bb.Set<int>("testInt", 123); bb.Set<Vector2>("TestVector2", new Vector2()); print(bb.Get<int>("testInt")); print(bb.Get<Vector2>("TestVector2")); }
// Update is called once per frame void Update() { // Gets Updated Blackboard ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; // If Specialist is active, act. if (ReadBlackBoard.PasSpec == PassiveSpecialists.BulletSpec) ReadProjLogic(); UpdateBlackBox(); }
public void Initialize(Character character) { _parentCharacter = character; WorkingMemory = new WorkingMemory(); WorkingMemory.Initialize(_parentCharacter); BlackBoard = new BlackBoard(); Sensor = new AISensor(); Sensor.Initialize(_parentCharacter); TargetingSystem = new AITargeting(); TargetingSystem.Initialize(_parentCharacter); WeaponSystem = new AIWeapon(); WeaponSystem.Initialize(_parentCharacter); Planner = new GoapPlanner(this); _goals = GameManager.Inst.DBManager.DBHandlerAI.GetCharacterGoalSet(_parentCharacter.GoapID); _actions = GameManager.Inst.DBManager.DBHandlerAI.GetCharacterActionSet(_parentCharacter.GoapID); _currentWorldStates = new List<GoapWorldState>(); _parentCharacter.MyEventHandler.OnCurrentActionComplete += OnCurrentActionComplete; _parentCharacter.MyEventHandler.OnPerFrameTimer += PerFrameUpdate; //update parent character for each action foreach(GoapAction action in _actions) { action.ParentCharacter = _parentCharacter; } //BlackBoard.PatrolLoc = new Vector3(63.9f, 0.3f, -13.3f); //BlackBoard.PatrolRange = new Vector3(30, 10, 15); if(ControlType != AIControlType.Player) { BlackBoard.GuardLevel = 1; _parentCharacter.SendCommand(CharacterCommands.SetAlert); } _currentGoal = null; _currentAction = null; _parentCharacter.MyEventHandler.OnOneSecondTimer += OnOneSecondTimer; }
// Use this for initialization void Start () { Memory = new BlackBoard(); Memory.Set<GameObject>("Player", GameObject.FindGameObjectWithTag("Player")); Conditional playerClose = new Conditional(isCloseToPlayer); Conditional playerMoving = new Conditional(isPlayerMoving); BehaviorAction MoveToPlayer = new BehaviorAction(moveToPlayer); BehaviorAction WanderAroundPlayer = new BehaviorAction(wanderAroundPlayer); Selector stayCloseToPlayer = new Selector( new Sequence( new Inverter(playerClose), playerMoving, MoveToPlayer ), WanderAroundPlayer ); behaviour = new BehaviorLibrary.Behavior(stayCloseToPlayer); }
void Awake() { //WORKING MEMORY wMemory = new WorkingMemory(); subsystemFacts = new List<string>(); blackBoard = BlackBoard.Instance; agentNumber = System.Guid.NewGuid(); showClanGUI(); showPlan = false; }
// Update is called once per frame void Update() { // Update Reac Black Board. ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; if (ReadBlackBoard.PasSpec == PassiveSpecialists.DistanceSpec) { ReadWallData(); ReadPlayerData(); } UpdateBlackBox(); }
public object this[string name, BlackBoard acces] { get { return (acces == BlackBoard.local) ? LocalBlackboard.GetObject(name) : GlobalBlackboard.GetObject(name);} set { if(acces == BlackBoard.local) LocalBlackboard.SetObject(name, value); else GlobalBlackboard.SetObject(name, value);} }
public GoalPlanning(BlackBoard BlackBoard) { this.BlackBoard = BlackBoard; }
public void Initialize(Character character) { _parentCharacter = character; WorkingMemory = new WorkingMemory(); WorkingMemory.Initialize(_parentCharacter); BlackBoard = new BlackBoard(); Sensor = new AISensor(); Sensor.Initialize(_parentCharacter); TargetingSystem = new AITargeting(); TargetingSystem.Initialize(_parentCharacter); WeaponSystem = new AIWeapon(); WeaponSystem.Initialize(_parentCharacter); Planner = new GoapPlanner(this); _goals = GameManager.Inst.DBManager.DBHandlerAI.GetCharacterGoalSet(_parentCharacter.ID); _actions = GameManager.Inst.DBManager.DBHandlerAI.GetCharacterActionSet(_parentCharacter.ID); _currentWorldStates = new List<GoapWorldState>(); _parentCharacter.MyEventHandler.OnNewEnemyTargetFound += OnImportantEvent; _parentCharacter.MyEventHandler.OnCurrentActionComplete += OnCurrentActionComplete; //update parent character for each action foreach(GoapAction action in _actions) { action.ParentCharacter = _parentCharacter; } BlackBoard.PatrolLoc = new Vector3(-15, 0, -15); BlackBoard.PatrolRange = new Vector3(20, 10, 20); BlackBoard.HasPatrolInfo = true; if(ControlType != AIControlType.Player) { _currentGoal = null; _currentAction = null; FindAndExecuteAction(); } }
// Use this for initialization void Awake() { // Instantiate the BBoard ReadBlckBrd = new BlackBoard(); WriteBlckBrd = new BlackBoard(); }
// This is called once per frame, after the Update function of every object void LateUpdate() { // Update the Read black board with all the information that was read on this frame ReadBlckBrd = WriteBlckBrd; }
public WorkingMemory() { knownFacts = new Dictionary<string, List<WorkingMemoryValue>>(); blackBoard = BlackBoard.Instance; }
// Update is called once per frame void Update() { // Gets updated Black Board. ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; // Enables Debug Interface if (Input.GetKeyDown(KeyCode.P)) { DebugText = !DebugText; DebugTxtsObj.SetActive(DebugText); } // Only try to update debug variables if Debug Interface is enabled. if(DebugText) { #region Distance Variables BossLocLbl.text = ReadBlackBoard.CurBossLoc.ToString(); PlyrLocLbl.text = ReadBlackBoard.PlyrLoc.ToString(); PlyrDistLbl.text = ReadBlackBoard.PlyrDist.ToString(); if (ReadBlackBoard.isAtSafeDistance) SafeDistanceLbl.text = "Safe Distance!"; else SafeDistanceLbl.text = "Not Safe Distance!"; if (ReadBlackBoard.isMovingToOtherSide) isBossMoveScreenLbl.text = "Going to other side!"; else isBossMoveScreenLbl.text = "Not going to other side!"; BossDestLbl.text = ReadBlackBoard.DestBossLoc.ToString(); if (ReadBlackBoard.isPlyrLinedUp) FacingPlayerLbl.text = "Player Lined Up!"; else FacingPlayerLbl.text = "Player Not Lined Up!"; #endregion #region Boss Behavior Variables BossBhvrLbl.text = ReadBlackBoard.BossBhvr.ToString(); #endregion #region Bullet Variables if (ReadBlackBoard.AreBulletsNear) AreBulletsNearLbl.text = "Bullets Are Near"; else AreBulletsNearLbl.text = "Bullets Are Not Near"; TotalBulletsNearLbl.text = ReadBlackBoard.NumberBulletsNear.ToString(); #endregion #region Specialists ActSpecLbl.text = ReadBlackBoard.ActSpec.ToString(); PasSpecLbl.text = ReadBlackBoard.PasSpec.ToString(); #endregion } // Update HealthBars: BossHp.fillAmount = ReadBlackBoard.BossHP; PlayerHP.fillAmount = ReadBlackBoard.PlyrHP; }
/// <summary>Initializes static members of the <see cref="EntitySystem"/> class.</summary> static EntitySystem() { BlackBoard = new BlackBoard(); }
// Update is called once per frame void Update() { // Gets updated Black Board. ReadBlackBoard = BlkBrdMngr.ReadBlckBrd; // Part of the move to the other side loop if (MovingToOtherSide) MoveToOtherSide(ReadBlackBoard.CurBossLoc); // Makes sure Boss is ALWAYS facing player FacePlayer(); // If Specialist is active, act. if (ReadBlackBoard.ActSpec == ActionSpecialists.MoveSpec) MoveLogic(); // Updates Write BlackBoard with MovingToOtherSide bool BlkBrdMngr.WriteBlckBrd.isMovingToOtherSide = MovingToOtherSide; }