// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { brain = animator.GetComponent <BrainManager>(); brain.indicatorRend.enabled = true; creature = animator.GetComponent <UniqueCreature>(); brain.outline.enabled = true; ms = animator.GetComponent <MovementSystem>(); ms.finishedMoving = true; List <Ability> abilityList = brain.GetComponent <UnitAbilitiesContainer>().abilities; abilityCanvas = brain.manager.hotbar; abilitySelector = abilityCanvas.GetComponent <AbilitySelector>(); abilitySelector.abilityList = abilityList; abilitySelector.setAbilityList = true; abilitySelector.SelectedAbilityButton(-1); abilityButtons = abilitySelector.AbilityButtons; for (int i = 0; i < abilityButtons.Length; i++) { if (i < abilityList.Count) { abilityButtons[i].GetComponent <Button>().interactable = true; abilityButtons[i].GetComponent <AbilityButtonHighlight>().isEnabled = true; abilityButtons[i].GetComponent <AbilityButtonHighlight>().ability = abilityList[i]; } else { abilityButtons[i].GetComponent <Button>().interactable = false; abilityButtons[i].GetComponent <AbilityButtonHighlight>().isEnabled = false; } } possible = ms.GetPossible(creature.movementLeft); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { brain = animator.GetComponent <BrainManager>(); brain.outline.enabled = true; abilityCanvas = brain.manager.hotbar; abilitySelector = abilityCanvas.GetComponent <AbilitySelector>(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { brain = animator.GetComponent <BrainManager>(); ms = animator.GetComponent <MovementSystem>(); brain.outline.enabled = true; float min = Vector3.Distance(animator.transform.position, brain.manager.playerUnits[0].transform.position); int playerToAttack = 0; for (int i = 0; i < brain.manager.playerUnits.Count; i++) { float temp = Vector3.Distance(animator.transform.position, brain.manager.playerUnits[i].transform.position); if (temp < min) { min = temp; playerToAttack = i; } } Tile targetedPlayer = brain.manager.playerUnits[playerToAttack].GetComponent <MovementSystem>().currentTile; PickTarget(targetedPlayer); if (target && target.unitOnTile == null) { ms.Move(target); } else { ms.finishedMoving = true; Debug.Log("Does not have target location"); } }
void Awake() { instance = this; mats = new Material[3]; mats[0] = Resources.Load <Material>("Materials/Blue"); mats[1] = Resources.Load <Material>("Materials/Red"); mats[2] = Resources.Load <Material>("Materials/idleTimer"); Panel = GameObject.Find("QuizPanel").transform.Find("Panel").gameObject; LeftBox = GameObject.Find("Left"); RightBox = GameObject.Find("Right"); Timer = GameObject.Find("Timer"); ScoreText = GameObject.Find("Score").transform.Find("ScoreText").gameObject; FloorText = GameObject.Find("pCylinder1").transform.Find("Text").GetComponent <TextMesh>(); GameOver_HighScore = GameObject.Find("HighScore").transform.Find("score").gameObject; WindHowlSound = GameObject.Find("WindSound"); TimerAnimation = Timer.GetComponent <Animator>(); DoorAnimation = GameObject.Find("liftdoor_lambert").GetComponent <Animator>(); FloorAnimation = GameObject.Find("liftdoor_floor").GetComponent <Animator>(); GameStartAnimation = GameObject.Find("MainPanel").GetComponent <Animator>(); mats[0] = Resources.Load <Material>("Materials/Blue"); mats[1] = Resources.Load <Material>("Materials/Red"); mats[2] = Resources.Load <Material>("Materials/idleTimer"); this.GetComponent <HandleTextFile>().QuizFunction = GameObject.Find("QuizPanel").transform.Find("Panel").gameObject; //this.GetComponent<HandleTextFile>().GetHightScore(); }
public void nextTurn() { activePlayer = manager.NextEntity().GetComponent <BrainManager>(); text.text = "Current Player: " + activePlayer.GetName(); activePlayer.isMyTurn = true; // Reset Turn Behaviors activePlayer.GetComponent <UniqueCreature>().movementLeft = activePlayer.GetComponent <UniqueCreature>().stats.movement; activePlayer.GetComponent <UniqueCreature>().action = true; }
private void brainReiverCallback(BrainManager manager) { string over_time = DateTime.Now.ToString("yyyy/MM/dd/ HH:mm:ss"); int numRow = manager.getStreamLog().Count / 513; WriteFile.writeFinishCode(runPath + "/" + "streamLog.csv", startTime, over_time, manager.getStreamLog(), 513, numRow, null); WriteFile.writeFinishCode(runPath + "/" + "dataLog.csv", startTime, over_time, manager.getDataLog(), 512, numRow, fftTitleItem()); WriteFile.writeFinishCode(runPath + "/" + "Brain.csv", "", "", manager.getBrainList(), 1, numRow, brashTitleItem()); WriteFile wr = new WriteFile(runPath); wr.BrainToNBrain(); }
void Start() { winCanvas.enabled = false; loseCanvas.enabled = false; manager = new TurnOrderController(units.ToArray());//, new RandomShuffler<GameObject>()); activePlayer = manager.NextEntity().GetComponent <BrainManager>(); text.text = "Current Player: " + activePlayer.GetName(); activePlayer.isMyTurn = true; // Reset Turn Behaviors activePlayer.GetComponent <UniqueCreature>().movementLeft = activePlayer.GetComponent <UniqueCreature>().stats.movement; activePlayer.GetComponent <UniqueCreature>().action = true; }
void Start() { //health = maxHealth; brain = GetComponent <BrainManager>(); currentMat = GetComponent <Renderer>(); abilityContainer = GetComponent <UnitAbilitiesContainer>(); stats = GetComponent <UnitStats>(); outline = GetComponent <Outline>(); ms = GetComponent <MovementSystem>(); damageMessage = GetComponent <HealthBar>().popup; audioSource = GetComponent <BrainManager>().manager.AudioSource; health = maxHealth; movementLeft = stats.movement; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { brain = animator.GetComponent <BrainManager>(); ms = animator.GetComponent <MovementSystem>(); float min = Vector3.Distance(animator.transform.position, brain.manager.playerUnits[0].transform.position); int playerToAttack = 0; for (int i = 1; i < brain.manager.playerUnits.Count; i++) { float temp = Vector3.Distance(animator.transform.position, brain.manager.playerUnits[i].transform.position); if (temp < min) { min = temp; playerToAttack = i; } } Target = brain.manager.playerUnits[playerToAttack]; abilitiesContainer = brain.creature.abilityContainer; }
void Start() { brain = GetComponent <BrainManager>(); lr = GetComponent <LineRenderer>(); }
private void customRun(SerialPort BluetoothConnection) { ArrayList streamLogList = new ArrayList(); ArrayList dataLogList = new ArrayList(); ArrayList brainList = new ArrayList(); ArrayList fftList = new ArrayList(); ArrayList tempList = new ArrayList(); int check = 0; int init = 0; while (isRun) { String Value = BluetoothConnection.ReadByte().ToString("X2"); String res = Value; if (Value.Equals("AA") && check == 0) { check = 1; tempList.Add(res); } else if (Value.Equals("AA") && check == 1) { check = 2; tempList.Add(res); } else if (Value.Equals("04") && check == 2) { ArrayList item = new ArrayList(); ArrayList newItem = new ArrayList(); Boolean brash_check = false; int brash_init = 0; for (int x = 0; x < tempList.Count; x++) { if (x == tempList.Count - 1 || x == tempList.Count - 2) { newItem.Add(tempList[x]); } else { if (tempList[x].Equals("AA") && brash_init == 0) { brash_init = 1; item.Add(tempList[x]); } else if (tempList[x].Equals("AA") && brash_init == 1) { brash_init = 2; item.Add(tempList[x]); } else if (tempList[x].Equals("04") && brash_init == 2) { brash_init = 0; item.Add(tempList[x]); brash_check = false; } else if (tempList[x].Equals("20") && brash_init == 2) { brash_init = 0; item.Add(tempList[x]); brash_check = true; } else if (tempList[x].Equals("AA") && brash_init == 2) { brash_init = 2; item.Add(tempList[x]); } else { brash_init = 0; item.Add(tempList[x]); } } } if (init == 2) { String getTime = DateTime.Now.ToString("yyyy/MM/dd/ HH:mm:ss.fffff"); item.Insert(0, getTime); streamLogList.Add(item); if (brash_check) { ArrayList refresh_item = new ArrayList(); int refresh = 0; int datalog = 0; String code = ""; for (int i = 0; i < item.Count; i++) { if (i == 0) { refresh_item.Add(item[i]); } else if (i < 7 && i > 0) { continue; } else if (datalog < 8) { code = code + item[i]; if (refresh == 0) { refresh = 1; } else if (refresh == 1) { refresh = 2; } else if (refresh == 2) { datalog = datalog + 1; refresh = 0; String add = (String)code.Clone(); refresh_item.Add(Calculate.run16ToString(add)); code = ""; } } else { if (datalog == 10 || datalog == 12) { refresh_item.Add(Calculate.run16ToString((String)item[i])); } datalog = datalog + 1; } } brainList.Add(refresh_item); ArrayList brain_list = (ArrayList)brainList.Clone(); if (abrainCallback != null) { abrainCallback(brain_list); } } else { ArrayList refresh_item = new ArrayList(); refresh_item.Add(item[0]); if (item.Count > 5) { String code = (String)item[6] + (String)item[7]; String code_result = Calculate.run16To2(code); refresh_item.Add(code_result); dataLogList.Add(refresh_item); fftList.Add(code_result); if (fftList.Count == 2048) { ArrayList fft = (ArrayList)fftList.Clone(); if (aSectionCallback != null) { aSectionCallback(fft); } fftList.Clear(); } } } } if (init == 1) { init = 2; } tempList.Clear(); tempList = (ArrayList)newItem.Clone(); check = 0; tempList.Add(res); } else if (Value.Equals("20") && check == 2) { ArrayList item = new ArrayList(); ArrayList newItem = new ArrayList(); for (int x = 0; x < tempList.Count; x++) { if (x == tempList.Count - 1 || x == tempList.Count - 2) { newItem.Add(tempList[x]); } else { item.Add(tempList[x]); } } if (init == 2) { String getTime = DateTime.Now.ToString("yyyy/MM/dd/ HH:mm:ss.fffff"); item.Insert(0, getTime); streamLogList.Add(item); } if (init == 0) { init = 1; } tempList.Clear(); tempList = (ArrayList)newItem.Clone(); check = 0; tempList.Add(res); } else if (Value.Equals("AA") && check == 2) { check = 2; tempList.Add(res); } else { check = 0; tempList.Add(res); } } BrainManager manager = new BrainManager(streamLogList, dataLogList, brainList); if (aCallback != null) { aCallback(manager); } bluetoothConnection.Close(); bluetoothThread.Abort(); }