void UpdateWaitingForResourcesLoaded() { float progress = 0; bool complete = true; foreach (CustomResource resource in resourcesLoading) { progress += resource.www.progress; if (!resource.www.isDone) { complete = false; } } // Update progress bar if (resourcesLoading.Count > 0) { progress /= resourcesLoading.Count; } else { progress = 1; } progressText.text = "Loading custom resources... " + Mathf.Round(progress * 100).ToString() + "%"; if (complete) { OnResourceLoadingComplete(); currentState = UpdateWaitingForPackingCompelte; } }
public void StartFade() { Debug.Log("Save event"); alpha += fadeSpeed * Time.deltaTime; currentUpdateState = UpdateFadeIn; }
public GameplayStateSystem(float playFromTime, bool botEnabled) { this.botEnabled = botEnabled; this.playFromTime = playFromTime; currentUpdate = UpdateWaitingForNotesSettled; }
void UpdateWaitingForSaveEnd() { if (CheckSaveConcluded()) { currentUpdateState = UpdateFadeOut; } }
public GameplayStateSystem(HitWindowFeeder hitWindowFeeder, bool botEnabled) { this.hitWindowFeeder = hitWindowFeeder; this.botEnabled = botEnabled; currentUpdate = UpdateWaitingForNotesSettled; }
protected StateMachine(int _stateCount) { mCurrentState = mNextState = INVALID_STATE; mUpdateFn = new UpdateFn[_stateCount]; mEnterFn = new EnterFn[_stateCount]; mExitFn = new ExitFn[_stateCount]; }
protected void SetStateFn(int _state, UpdateFn _update, EnterFn _enter = null, ExitFn _exit = null) { Debug.Assert(_state != INVALID_STATE); Debug.Assert(_state < mUpdateFn.Length); mUpdateFn[_state] = _update; mEnterFn[_state] = _enter; mExitFn[_state] = _exit; }
void Start() { feasibleStates = new List <string> () { "on-hold", "on-play" }; lastState = feasibleStates [0]; myEventScript = GetComponent <EventScript> (); myUpdateFn = FindObjectOfType <UpdateFn> (); }
void UpdateWaitingForNotesSettled() { // We need to wait a couple of frames for the physics system to settle down, otherwise notes can be sprawled all over the place if we're being spammy about playing --hitWindowFrameDelayCount; if (hitWindowFrameDelayCount <= 0) { currentUpdate = UpdateGameplay; } }
// Use this for initialization void Start() { myUpdate = FindObjectOfType <UpdateFn> (); if (PlayerPrefs.HasKey("userID")) { userID = PlayerPrefs.GetString("userID"); Debug.Log("UserID " + userID + " login succesfully"); } }
// Use this for initialization void Start() { Application.runInBackground = true; assetPacker = GetComponent <AssetPacker>(); currentState = UpdateWaitingForResourcesLoaded; #if UNITY_EDITOR skinDirectory = Directory.GetParent(Application.dataPath) + "\\" + skinDirectory; #else skinDirectory = DirectoryHelper.GetMainDirectory() + "\\" + skinDirectory; #endif Debug.Log("Loading skin from directory " + skinDirectory); if (Directory.Exists(skinDirectory)) { SetupResourcesToLoad(); // Collect all the files string[] filepaths = GetAllFiles(skinDirectory).ToArray(); Dictionary <string, string> filepathsDictionary = new Dictionary <string, string>(); int bgCount = 0; foreach (string path in filepaths) { filepathsDictionary.Add(Path.GetFileNameWithoutExtension(path), path); // System.Text.RegularExpressions.Regex.Match(Path.GetFileNameWithoutExtension(path), @"background-/([0-9]+)$"); //if ( Path.GetFileNameWithoutExtension(path).Contains("background-\d+")) if (System.Text.RegularExpressions.Regex.Match(Path.GetFileNameWithoutExtension(path), @"background-[0-9]+").Success) { resources.Add(new CustomTexture(Path.GetFileNameWithoutExtension(path), 1920, 1080)); ++bgCount; } } Debug.Log("Total backgrounds: " + bgCount); foreach (CustomResource resource in resources) { if (resource.InitWWW(filepathsDictionary)) { resourcesLoading.Add(resource); resourcesDictionary.Add(resource.name, resource); } } } else { Debug.LogError("Custom Resources not found"); } }
void UpdateFadeOut() { alpha -= fadeSpeed * Time.deltaTime; alpha = Mathf.Clamp01(alpha); saveText.color = new Color(saveText.color.r, saveText.color.g, saveText.color.b, alpha); if (alpha <= 0) { currentUpdateState = null; } }
public IndicatorPressedInputSystem(HitAnimation[] animations, Chart.GameMode gameMode) { this.animations = animations; switch (gameMode) { case Chart.GameMode.Drums: { updateFn = UpdateDrumPadPresses; break; } default: { updateFn = UpdateGuitarFretPresses; break; } } }
void UpdateFadeIn() { if (CheckSaveConcluded()) { // Don't bother displaying the save anim for super short saves currentUpdateState = UpdateFadeOut; } else { alpha += fadeSpeed * Time.deltaTime; alpha = Mathf.Clamp01(alpha); saveText.color = new Color(saveText.color.r, saveText.color.g, saveText.color.b, alpha); if (alpha >= 1.0f) { currentUpdateState = UpdateWaitingForSaveEnd; } } }
// Use this for initialization void Start() { Application.runInBackground = true; assetPacker = GetComponent <AssetPacker>(); currentState = UpdateWaitingForResourcesLoaded; #if UNITY_EDITOR skinDirectory = Directory.GetParent(Application.dataPath) + "\\" + skinDirectory; #else skinDirectory = DirectoryHelper.GetMainDirectory() + "\\" + skinDirectory; #endif Debug.Log("Loading skin from directory " + skinDirectory); if (Directory.Exists(skinDirectory)) { SetupResourcesToLoad(); // Collect all the files string[] filepaths = GetAllFiles(skinDirectory).ToArray(); Dictionary <string, string> filepathsDictionary = new Dictionary <string, string>(); int bgCount = 0; foreach (string path in filepaths) { string assetKey = Path.GetFileNameWithoutExtension(path); if (!filepathsDictionary.ContainsKey(assetKey)) { filepathsDictionary.Add(assetKey, path); } else { Debug.LogWarning("Found a duplicate custom asset with under a different file extenstion. Ignoring asset " + path); continue; } // Checking if the file provided is a background. We have no limit on the amount of backgrounds we can load, so we can't pre-define them like we do above. if (System.Text.RegularExpressions.Regex.Match(assetKey, @"background-[0-9]+").Success) { resources.Add(new CustomTexture(assetKey, 1920, 1080)); ++bgCount; } } Debug.Log("Total backgrounds: " + bgCount); foreach (CustomResource resource in resources) { if (resource.InitWWW(filepathsDictionary)) { resourcesLoading.Add(resource); resourcesDictionary.Add(resource.name, resource); } } } else { Debug.LogError("Custom Resources not found"); } }