// Start is called before the first frame update void Start() { gameController = FindObjectOfType <GameController>(); Speed = Speed * ((GameObject.Find("ShoppingList").GetComponent <ShoppingList>().numberOfProductsBought + 1)); Move = new Vector3(Speed, 0, 0); body = this.GetComponent <Rigidbody>(); Food = this.gameObject; ugiu = FindObjectsOfType <TextMeshProUGUI>(); int i; for (i = 0; i < ugiu.Length; i++) { if (ugiu[i].name.Contains("ShoppingList")) { shoppingList = ugiu[i]; break; } else { print("Wrong UGIU"); } } shoppingListScript = FindObjectOfType <ShoppingList>().GetComponent <ShoppingList>(); scoreController = ScoreController.Instance; }
public async Task ScoreTask(string taskId, ScoreAction action) { var actionStr = Enum.GetName(action.GetType(), action).ToLower(); using (var client = CreateWebClient()) await client.UploadStringTaskAsync($"{baseUrl}/tasks/{taskId}/score/{actionStr}", "POST", ""); }
public void SetUp() { state = new GameState(new Word("a")); letterAsk = Substitute.For <ILetterAsk>(); output = Substitute.For <TextWriter>(); scoreAction = new ScoreAction(10, letterAsk, output); }
// Constructor public ScoreEdit(ScoreAction scoreAction, object collection, int index, object item) { this.collection = collection; this.scoreAction = scoreAction; this.index = index; this.itemB = item; Execute(); }
public void AddScoreAction(ScoreAction scoreAction) { _scoreActions.Add(scoreAction); if (_scoreActions.Count == 3) { Mediator.NotifyColleagues(MessageType.SetIsDartboardScoreInputActive, false); } Mediator.NotifyColleagues(MessageType.DisableUndoLastScoreAction, false); RaiseOnPropertyChanged(); }
// private void Update() // { // switch (gameState) // { // case GameState.End: //#if UNITY_EDITOR // if (Input.anyKeyDown) // { // level++; // SceneManager.LoadScene(0); // } //#elif UNITY_ANDROID // if (Input.touchCount > 0) // { // level++; // SceneManager.LoadScene(0); // } //#endif // break; // } // } private void UpdateScene(Scene scene, LoadSceneMode loadSceneMode) { GameStart(); score = 0; //null action because it will get a missing ref exception if it is not cleared scoreAction = null; startAction = null; countAction = null; endAction = null; }
public int GetActionValue(ScoreAction Action) { foreach (var scoreRecipe in Database.ScoreRecipes) { if (scoreRecipe.Action == Action) { return(scoreRecipe.ScoreValue); } } return(0); }
public ScoreAction CheckoutScoreActions() { var scoreActionToCheckout = new ScoreAction { Multiplier = 1, Score = GetScoreActionsSum() }; if (_scoreActions.Count == 0) { scoreActionToCheckout = null; } Reset(); return(scoreActionToCheckout); }
public void AddScoreAction(ScoreAction scoreAction) { AverageScoreActionsPerRound.AddScoreAction(scoreAction); OnPropertyChanged("AverageScoreActionsPerRound"); if (CurrentScore > 1) { return; } if (CurrentScore < 0 || CurrentScore == 1 || (CurrentScore == 0 && scoreAction.Multiplier != 2)) { AverageScoreActionsPerRound.RevertAllScoreActions(); } OnPropertyChanged("AverageScoreActionsPerRound"); OnPropertyChanged("CurrentScore"); }
/// <summary> /// Setup of dependencies and initial state. /// </summary> private void Start() { // Dependencies: timer = TimerImpl.Instance; uiAction = UiController.Instance; scoreAction = ScoreController.Instance; // Setup: // Register consumer of time updates: timer.addTimeConsumer(scoreAction.nextTime); //timer.addTimeConsumer(time => Debug.Log("Time left: " + time)); // Set initial game state and start the game implicitly. SetGameState(currentGameState); // Debug.Log("GameController.Start()"); }
//private int brickHitMultiplier = 1; public void AddPoints(ScoreAction action, int multiplier = 1) { int points = 0; switch (action) { case ScoreAction.BrickHit: points = 10; break; case ScoreAction.PowerupGrab: points = 5; break; } Score += points * multiplier; RefreshScoreDisplay(); }
// Start is called before the first frame update void Start() { shoppingList = new HashSet <string>(); shoppingList.Add("avocado"); scoreAction = ScoreController.Instance; cube = this.transform.GetChild(0).gameObject; bag = GameObject.Find("Bag"); sphere = GameObject.Find("ScannerLaserSphere"); canDropToBag = true; timeToNext = 0.0f; toDrop = null; lineRenderer = transform.GetChild(0).GetComponent <LineRenderer>(); lineRenderer.enabled = false; sphere.SetActive(false); scannedObjects = new Queue <GameObject>(); audio = GetComponent <AudioSource>(); device = InputDevices.GetDeviceAtXRNode(XRNode.RightHand); }
private static string GetScoreActionPrefix(ScoreAction scoreAction) { string commaSeparatedScoreActions = ""; switch (scoreAction.Multiplier) { case 2: { commaSeparatedScoreActions += "D"; break; } case 3: { commaSeparatedScoreActions += "T"; break; } } return(commaSeparatedScoreActions); }
// Execute public void Execute() { if (scoreAction == ScoreAction.EraseNote) { scoreAction = ScoreAction.InsertNote; try { ((List <object>)collection).Remove((Audio.Note)itemB); } catch { if (itemA != null) { ((List <Audio.Command>)collection).Remove((Audio.Command)itemA); } ((List <Audio.Command>)collection).Remove((Audio.Command)itemB); if (itemC != null) { ((List <Audio.Command>)collection).Remove((Audio.Command)itemC); } } } else if (scoreAction == ScoreAction.InsertNote) { scoreAction = ScoreAction.EraseNote; try { ((List <object>)collection).Insert(index, (Audio.Note)itemB); } catch { if (itemC != null) { ((List <Audio.Command>)collection).Insert(index, (Audio.Command)itemC); } ((List <Audio.Command>)collection).Insert(index, (Audio.Command)itemB); if (itemA != null) { ((List <Audio.Command>)collection).Insert(index, (Audio.Command)itemA); } } } else if (scoreAction == ScoreAction.PasteNotes) { scoreAction = ScoreAction.DeleteNotes; try { ((List <object>)collection).InsertRange(index, (List <object>)items); } catch { ((List <Audio.Command>)collection).InsertRange(index, (List <Audio.Command>)items); } } else if (scoreAction == ScoreAction.DeleteNotes) { scoreAction = ScoreAction.PasteNotes; try { ((List <object>)collection).RemoveRange(index, ((List <object>)items).Count); } catch { ((List <Audio.Command>)collection).RemoveRange(index, ((List <Audio.Command>)items).Count); } } else if (scoreAction == ScoreAction.AddStaff) { scoreAction = ScoreAction.DeleteStaff; ((List <Audio.Staff>)collection).Insert(index, (Audio.Staff)itemB); } else if (scoreAction == ScoreAction.DeleteStaff) { scoreAction = ScoreAction.AddStaff; ((List <Audio.Staff>)collection).Remove((Audio.Staff)itemB); } }
private void Awake() { Instance = this; score = 0; }
// Start is called before the first frame update void Start() { controller = ScoreController.Instance; }