public void ChangeWave(Difficulty diff) { switch (diff) { case Difficulty.easy: currentCardsAvailable.SetValue(16); break; case Difficulty.medium: currentCardsAvailable.SetValue(32); break; case Difficulty.hard: currentCardsAvailable.SetValue(48); break; } Shuffle(sprites); for (int i = 0; i < currentCardsAvailable.Value; i++) { images [i] = Extensions.textureFromSprite(sprites [i]); images [i].name = sprites [i].name; } InstantiateCards(); }
public void SetMove() { if (movement.x != 0 || movement.y != 0) { anim.SetBool("isMoving", true); anim.SetFloat("moveX", movement.x); anim.SetFloat("moveY", movement.y); //Set Facing if (movement.y == 1) { facing.SetValue(0); } if (movement.x == 1) { facing.SetValue(1); } if (movement.y == -1) { facing.SetValue(2); } if (movement.x == -1) { facing.SetValue(3); } } else { anim.SetBool("isMoving", false); } }
// Use this for initialization void Start() { _score = 0; _combo = 0; if (actualScore != null) { actualScore.SetValue(0); } if (highScore) { highScore.SetValue(PlayerPrefs.GetInt(HIGH_SCORE_KEY)); } }
private void AddFlea() { int newFleasValue = fleaScore.GetValue() + 1; fleaScore.SetValue(newFleasValue); fleaCollected.Invoke(); }
//Resets player stats when game ends private void OnApplicationQuit() { playerInventory.ClearInventory(); hasShowInitialStory.SetValue(false); canPlayerMove.SetValue(true); canPlayerInteract.SetValue(true); numberOfFinalItems.SetValue(0); }
public void SetupGame() { GameState.SetValue(true); bgm.Play(); startingBlocks.Setup(); score.SetValue(0f); breakCount.SetValue(0); OnGameSetup?.Invoke(); }
public void ChangeDifficulty() { var value = (int)difficulties[currentAdvancement]; difficultyAtom.SetValue(value + 1); currentAdvancement++; difficultyTextMeshLinker.Refresh(); }
public void CollectSpark() { float amount = Charge + 1.0f; Charge = Mathf.Clamp(amount, 0, MaxCharge.GetValue()); int sparksCollected = SparksCollected.GetValue() + 1; SparksCollected.SetValue(sparksCollected); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); IntVariable variable = (IntVariable)target; GUILayout.Space(20); GUILayout.BeginHorizontal(); valueToSet = GUILayout.TextField(valueToSet, 50); if (GUILayout.Button("Set value")) { variable.SetValue(int.Parse(valueToSet)); variable.Save(); } GUILayout.EndHorizontal(); GUILayout.Space(20); if (variable.isPersistent) { if (GUILayout.Button("Load pref")) { variable.Load(); } if (GUILayout.Button("Reset pref")) { variable.Clear(); } if (GUILayout.Button("Set default")) { variable.SetValue(variable.DefaultValue); variable.Save(); } if (GUILayout.Button("Reset all prefs")) { PlayerPrefs.DeleteAll(); } } }
public void Refresh() { difficultyAtom.SetValue(storySequence.Difficulty); rivalNameTextMesh.text = storySequence.RivalName; rivalNicknameTextMesh.text = storySequence.RivalNickname; sequenceNameTextMesh.text = storySequence.SequenceName; rivalImage.texture = storySequence.RivalThumbnail.texture; starImage.color = this.storySequence.hasBeenPerfectlyCompleted ? enabledColor : disabledColor; }
void OnGUI() { if (gameState.State == "Not Loaded" && DrawButtons("LoadGame")[0]) { StartCoroutine(FakeLoadRoutine()); } if (gameState.State == "Loading") { DrawSlider(loadProgress, 0, 1); } if (gameState.State == "Loaded" && DrawButtons("Start Game")[0]) { Macro.StartGame(); } if (gameState.State == "Started" && gameState.WinState == "Unspecified") { var winStates = DrawButtons("Win", "Lose"); if (winStates[0]) { Macro.Win(); } if (winStates[1]) { Macro.Lose(); } } if (gameState.State == "Started" && gameState.WinState != "Unspecified" && DrawButtons("End Game")[0]) { Macro.EndGame(); } DrawLabel(string.Format("Game State : {0}", gameState.State)); DrawLabel(string.Format("Win State : {0}", gameState.WinState)); DrawLabel(string.Format("Timer : {0}", RemainingTime.Value == -1 ? "Not Started" : Math.Round(RemainingTime.Value, 2).ToString())); DrawLabel(string.Format("Displayed Verb : {0}", verbLoader.IsVerbDisplayed ? "None" : verbLoader.CurrentVerb)); DrawLabel(string.Format("BeatCount : {0}", BeatCount.Value)); DrawLabel(string.Format("BPM : {0}", BPM.Value)); if (gameState.State == "Not Loaded") { BPM.SetValue((int)DrawSlider(BPM.Value, 1, 200)); } DrawLabel(string.Format("Difficulty : {0}", Difficulty.Value)); if (gameState.State == "Not Loaded") { Difficulty.SetValue((int)DrawSlider(Difficulty.Value, 1, 3)); } GUI.Box(new Rect(anchor.x, anchor.y, width + (margin * 2), (GUICount * lineHeight) + (margin * 2)), GUIContent.none); GUICount = 0; }
public void LoadFromFile() { filePath = Application.persistentDataPath + "/HighScore.bin"; data = new Dictionary <string, int>(); FileStream stream = File.Open(filePath, FileMode.Open); var formatter = new BinaryFormatter(); if (stream.Length != 0) { data = formatter.Deserialize(stream) as Dictionary <string, int>; } stream.Close(); if (data.ContainsKey("HighScore")) { highScore.SetValue(data["HighScore"]); } else { highScore.SetValue(0); } }
public void BindValueFromInput(string newValue) { if (variableString != null) { variableString.SetValue(newValue); } if (variableInt != null) { if (newValue != "") { int x = 0; if (Int32.TryParse(newValue, out x)) { variableInt.SetValue(x); } } else { variableInt.SetValue(null); } } }
//private int totalEnemyScore; private void Awake() { //Debug.unityLogger.logEnabled = false; //result.text = ""; scoreHistory = new List <int>(); //awakeだとdelegate登録より先にinvokeされてしまう //awakeではなくstartでやればとりあえずできるが、今度はその変数を必要とする初期化処理がさらに遅れることになる money.SetValue(startingMoney); fame.SetValue(startingFame); matches.SetValue(0); totalScore.SetValue(0); }
public override void Update() { if (leftControl.Value > 0 && rightControl.Value > 0) { xDirection.SetValue(0); } else if (leftControl.Value > 0) { xDirection.SetValue(-1); } else if (rightControl.Value > 0) { xDirection.SetValue(1); } else { xDirection.SetValue(0); } if (downControl.Value > 0 && upControl.Value > 0) { yDirection.SetValue(0); } else if (downControl.Value > 0) { yDirection.SetValue(-1); } else if (upControl.Value > 0) { yDirection.SetValue(1); } else { yDirection.SetValue(0); } }
// Start is called before the first frame update void Start() { // Set to be 30 FPS Application.targetFrameRate = 30; marioBody = GetComponent <Rigidbody2D>(); marioSprite = GetComponent <SpriteRenderer>(); marioAnimator = GetComponent <Animator>(); GameManager.OnPlayerDeath += PlayerDiesSequence; cameraManager = GameObject.Find("Main Camera"); upSpeed.SetValue(gameConstants.playerMaxJumpSpeed); maxSpeed.SetValue(gameConstants.playerMaxSpeed); force = gameConstants.playerDefaultForce; }
public void SpeedUp() { animator.SetTrigger(speedUpId); if (currentAudioSequence.TransitionClips != null) { var nextClip = currentAudioSequence.Clips[iterations + 1]; var transitionClip = currentAudioSequence.TransitionClips[iterations]; StartCoroutine(SwitchClipRoutine(nextClip, transitionClip)); } else { } iterations++; bpmAtom.SetValue(bpmTraductions[iterations]); }
/// <summary> /// Lose a life. If lives is reduced to 0 or less, raise the game event. /// </summary> public void LoseALife() { #if UNITY_EDITOR if (invincibility) return; #endif lives.Value--; if (updateLivesGUIEvent != null) { updateLivesGUIEvent.Raise(); } if (lives.Value <= 0) { lives.SetValue(0); if (lostAllLives != null) { lostAllLives.Raise(); } } }
public void StartNewSequence(IGameSequence newSequence) { if (!isFinished) { return; } onSequenceOpenedAtomEvent.Raise(); loadOperation = null; sequenceAdvancementAtom.SetValue(1); currentSequence = newSequence; currentSequence.OpeningTransitionEvent.Raise(); isFinished = false; currentSequence.Initialize(); currentGame = currentSequence.FirstGame; transitionScreenAnimator.SetTrigger(fadeInId); }
private IEnumerator RecieveItemAnimation(InventoryItem item, GameObject itemObject) { _isRecievingItem = true; yield return(_itemController.RecieveItemAnimation(item, itemObject)); _itemController.neededItems.Clear(); _itemController.DestroySpeechBubble(); numberOfFinalItems.SetValue(numberOfFinalItems.GetValue() + 1); _isRecievingItem = false; if (numberOfFinalItems.GetValue() == 2) { _spriteRenderer.flipX = !_spriteRenderer.flipX; bigHeartAnimator.SetTrigger("startStory"); canPlayerMove.SetValue(false); _itemController.canPlayerInteract.SetValue(false); } }
public void SpeedChoice(int newSpeed) { speed.Value = newSpeed; speed.SetValue(newSpeed); }
public override void Execute(MonoBehaviour _behaviour) { Assert.IsNotNull(Variable, "Please set a Variable!"); Variable.SetValue(Value.GetValue()); }
public void DifficultyChoice(int newDifficulty) { difficulty.Value = newDifficulty; difficulty.SetValue(newDifficulty); }
public void SelectLevel(int level) { LoadLevel.SetValue(level); GotoNextScene(); }
// Start is called before the first frame update void Start() { dayCount.SetValue(0); timeReaminingInDay=dayDuration.Value; }
private void Start() { // Reset life health.SetValue(maxHealth); }
private void Awake() { valueToSet.SetValue(defaultValue); }
public void Play() { isPlaying = true; RefreshValues(); beatCountAtom.SetValue(1); }
/// <summary> /// Resets collectable/stars /// </summary> public void Reset_Callback() { gameWon = false; currentStar.SetValue(0); maxStar.SetValue(0); }
void Start() { scoreValue.SetValue(0); }