// Use this for initialization void Start() { //set default cursor starting positions blueCursorCurrentPosition.x = 0; blueCursorCurrentPosition.y = 0; redCursorCurrentPosition.x = 3; redCursorCurrentPosition.y = 0;//TODO first value should be number of rows - 1 //move cursors to starting positions MoveCursor(blueCursor, blueCursorCurrentPosition); blueSelectedNaviAsset = listOfCharacterProfiles[blueCursorCurrentPosition.x].naviAssetSO; bluePet.SetNaviPreview(blueSelectedNaviAsset.animatorOverrideController, blueSelectedNaviAsset.orientation, blueSelectedNaviAsset.READY); MoveCursor(redCursor, redCursorCurrentPosition); redSelectedNaviAsset = listOfCharacterProfiles[redCursorCurrentPosition.x].naviAssetSO; redPet.SetNaviPreview(redSelectedNaviAsset.animatorOverrideController, redSelectedNaviAsset.orientation, redSelectedNaviAsset.READY); if (playerManager == null) { playerManager = GameObject.Find("PlayerManager").GetComponent <PlayerManager>(); } //TODO count children and add to list }
private void GetMoveInput() { //p1 blue if (Input.GetKeyDown(KeyCode.W))//move up { blueSelectionUpdated = true; blueCursorCurrentPosition.y += 1; } else if (Input.GetKeyDown(KeyCode.S))//move down { blueSelectionUpdated = true; blueCursorCurrentPosition.y -= 1; } else if (Input.GetKeyDown(KeyCode.A))//move left { if (blueCursorCurrentPosition.x - 1 >= 0) { blueSelectionUpdated = true; blueCursorCurrentPosition.x -= 1; } } else if (Input.GetKeyDown(KeyCode.D))//move right { if (blueCursorCurrentPosition.x + 1 < listOfCharacterProfiles.Length) { blueSelectionUpdated = true; blueCursorCurrentPosition.x += 1; } } //p2 red if (Input.GetKeyDown(KeyCode.Keypad8))//move up { redSelectionUpdated = true; redCursorCurrentPosition.y += 1; } else if (Input.GetKeyDown(KeyCode.Keypad5))//move down { redSelectionUpdated = true; redCursorCurrentPosition.y -= 1; } else if (Input.GetKeyDown(KeyCode.Keypad4))//move left { if (redCursorCurrentPosition.x - 1 >= 0) { redSelectionUpdated = true; redCursorCurrentPosition.x -= 1; } } else if (Input.GetKeyDown(KeyCode.Keypad6))//move right { if (redCursorCurrentPosition.x + 1 < listOfCharacterProfiles.Length) { redSelectionUpdated = true; redCursorCurrentPosition.x += 1; } } if (redSelectionUpdated) //update cursor visual positions { MoveCursor(redCursor, redCursorCurrentPosition); //TODO integrate vertical movement if (!redSelectionConfirmed) { redSelectedNaviAsset = listOfCharacterProfiles[redCursorCurrentPosition.x].naviAssetSO; redPet.SetNaviPreview(redSelectedNaviAsset.animatorOverrideController, redSelectedNaviAsset.orientation, redSelectedNaviAsset.READY); } } if (blueSelectionUpdated) { MoveCursor(blueCursor, blueCursorCurrentPosition);//TODO integrate vertical movement if (!blueSelectionConfirmed) { blueSelectedNaviAsset = listOfCharacterProfiles[blueCursorCurrentPosition.x].naviAssetSO; bluePet.SetNaviPreview(blueSelectedNaviAsset.animatorOverrideController, blueSelectedNaviAsset.orientation, blueSelectedNaviAsset.READY); } } //reset flags redSelectionUpdated = false; blueSelectionUpdated = false; }//end GetMoveInput()