private void Start() { rb = GetComponent <Rigidbody>(); audio = GetComponent <AudioSource>(); currentScene = SceneManager.GetActiveScene().buildIndex; st = GameObject.Find("StatTracker").GetComponent <StatTracker>(); }
void populateStats(int playerNum) { StatTracker stat = stats[playerNum]; Canvas c = PlayerBox[playerNum].transform.Find("Canvas").GetComponent <Canvas>(); if (creator.getName(playerNum) != null) { c.transform.Find("PlayerName").GetComponent <Text>().text = creator.getName(playerNum); } c.transform.Find("Attacks").GetComponent <Text>().text = stat.attemptedAttacks.ToString(); if (stat.attemptedAttacks != 0) { c.transform.Find("Accuracy").GetComponent <Text>().text = (((float)stat.successfulHits / (float)stat.attemptedAttacks) * 100).ToString() + "%"; } else { c.transform.Find("Accuracy").GetComponent <Text>().text = 0.ToString(); } c.transform.Find("DamageDealt").GetComponent <Text>().text = stat.damageDealt.ToString(); c.transform.Find("DamageTaken").GetComponent <Text>().text = stat.damageTaken.ToString(); c.transform.Find("FinishersHit").GetComponent <Text>().text = stat.successfulFinishers.ToString(); c.transform.Find("FinisherMax").GetComponent <Text>().text = stat.maxFinisher.ToString(); c.transform.Find("ShieldStolen").GetComponent <Text>().text = stat.shieldStolen.ToString(); c.transform.Find("Dashes").GetComponent <Text>().text = stat.timesDashed.ToString(); c.transform.Find("Hitstalls").GetComponent <Text>().text = stat.hitStalls.ToString(); c.transform.Find("Projectiles").GetComponent <Text>().text = stat.projectilesFired.ToString(); }
public void Load() { //Here we are taking the objects which have the scripts we want to reference and finding the scripts to reference from those objects StatTracker statTrackerScript = statTrackerObject.GetComponent <StatTracker>(); TextChange textChangeScript = textChangeObject.GetComponent <TextChange>(); statTrackerScript.strength = ES3.Load <int>("strength"); statTrackerScript.corruption = ES3.Load <int>("corruption"); statTrackerScript.arcana = ES3.Load <int>("arcana"); //Not sure i did this right. in the load function the documentation says to do the key then the "default. Not sure I understood what a default is correctly statTrackerScript.importantHappeningsList = ES3.Load("importantHappeningsList", new List <string>()); statTrackerScript.choiceTraits = ES3.Load("choiceTraits", new List <string>()); //We load the page we were on textChangeScript.currentPage = ES3.Load <Page>("currentPage"); //This takes the information about the current page's text which should be displayed and puts it into the text object which is the main text of the story textChangeScript.mainText.text = textChangeScript.currentPage.description; //here we turn buttons to active or inactive textChangeScript.ButtonActivationChanges(textChangeScript.currentPage.buttonOneVisible, textChangeScript.currentPage.buttonTwoVisible, textChangeScript.currentPage.buttonThreeVisible, textChangeScript.currentPage.buttonFourVisible); //Here we update the text for buttons textChangeScript.ButtonTextChanges(textChangeScript.currentPage.buttonOneText, textChangeScript.currentPage.buttonTwoText, textChangeScript.currentPage.buttonThreeText, textChangeScript.currentPage.buttonFourText); Debug.Log("The Load Function was called"); }
void Start() { initialScale = rightDoor.localScale; StartCoroutine(OpenDoor()); tracker = (GameObject.FindGameObjectWithTag("UI") as GameObject).GetComponent<StatTracker>(); elevatorClose = this.GetComponent<AudioSource> (); }
private static float RANDOM_MINION_TIME_BETWEEN_EACH_MINION = .5f; // cikan minionlar yarim saniye aralikli olacak. #endregion /// <summary> /// Userlari kullanarak playerlar olusturur. Bu userlar icin setState(GAME) fonksiyonunu cagirir. /// GameState i ReadyWait e setler. /// </summary> /// <param name="users"></param> public Game(List <User> users) // her player in kullanacagi board i da almamiz gerek. ya da bu bilgiyi user dan cekebiliriz. TODO { foreach (User user in users) { Player pTemp = new Player(user, this); players.AddLast(pTemp); statPlayers.Add(pTemp); user.player = pTemp; } remainingPlayerCount += users.Count; float distance = calculateBoardDistanceToCenter(users.Count); for (int i = 0; i < users.Count; i++) { Vector3 rotation = new Vector3(0, i * 360.0f / users.Count, 0); users[i].player.board.rotation = rotation; users[i].player.board.position = new Vector3((float)Math.Cos(-1 * rotation.y * (Math.PI / 180.0)) * distance, 0, (float)(Math.Sin(-1 * rotation.y * (Math.PI / 180.0)) * distance)); users[i].player.board.nextBoard = users[(i + 1) % users.Count].player.board; users[i].player.board.prevBoard = users[(i + users.Count - 1) % users.Count].player.board; } this.statTracker = new StatTracker(this); setStateReadyWait(); }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if (user.userState == User.UserState.GAME) { StatTracker statTracker = user.player.game.statTracker; List <Player> recievers = new List <Player>(); recievers.Add(user.player); for (int i = 0; i < user.player.game.statPlayers.Count; i++) { if (user.player.game.statPlayers[i] != null) { for (int j = 0; j < statTracker.playerStatsList.Count; j++) { if (user.player == statTracker.playerStatsList[j].ownerPlayer) { statTracker.playerStatsList[j].income = user.player.income; statTracker.playerStatsList[j].cash = user.player.cash; break; } } } } OutgoingMessages.Game.GEndGameStatisticsResult.sendMessage(recievers, statTracker); } }
// Retrieve Stats from Player Prefs private void Awake() { instance = this; if (PlayerPrefs.HasKey("spikes")) { spikes = PlayerPrefs.GetInt("spikes", 0); } if (PlayerPrefs.HasKey("totalCoins")) { totalCoins = PlayerPrefs.GetInt("totalCoins", 0); } if (PlayerPrefs.HasKey("speed")) { speed = PlayerPrefs.GetInt("speed", 0); } if (PlayerPrefs.HasKey("invincibility")) { invincibility = PlayerPrefs.GetInt("invincibility", 0); } if (PlayerPrefs.HasKey("health")) { health = PlayerPrefs.GetInt("health", 0); } createArray(); }
private void OnDestroy() { if (Instance == this) { Instance = null; } }
private void OnLoaded(object sender, RoutedEventArgs e) { _dc = (StatTracker)DataContext; _anim = new DoubleAnimation(0, TimeSpan.FromMilliseconds(100)); _anim.Completed += (_, __) => _isAnimating = false; Timeline.SetDesiredFrameRate(_anim, 20); _toZeroAnimation = new DoubleAnimation(0, TimeSpan.FromMilliseconds(0)); Timeline.SetDesiredFrameRate(_toZeroAnimation, 20); _delay = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(_anim.Duration.TimeSpan.Milliseconds + 10) }; _delay.Tick += (_, __) => { _delay.Stop(); OnToZero(_lastDuration); }; if (_dc == null) { return; } _dc.ToZero += OnToZero; _dc.PropertyChanged += OnPropertyChanged; }
// Start is called before the first frame update void Start() { lm = Toolbox.getInstance().levelManager; statTracker = Toolbox.getInstance().statTracker; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); //use those 2 lines to get components from other scripts lm.nextScene = myLevel; }
// Start is called before the first frame update void Awake() { playerController = GetComponent <PlayerController>(); bombInteractable = GetComponent <BombInteractable>(); StatTracker = ScriptableObject.CreateInstance <StatTracker>(); playerList.AddItem(this); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); stats = this.GetComponent <StatTracker>(); direction = Vector2.zero; obstacleAvoidVec = Vector2.zero; weapon = transform.GetChild(0).gameObject; }
private void OnDestroy() { ObserverSubjectBridge bridge = ObserverSubjectBridge.Instance; StatTracker tracker = StatTracker.Instance; bridge.RemoveObserverFrom <HealthChangeEvent>(tracker, this); bridge.RemoveObserverFrom <DeathEvent>(tracker, this); }
// Use this for initialization void Start() { tracker_ = GetComponent <StatTracker>(); q_ = new TabQ(env, 0.0f); epsilon_ = startEpsilon; tracker_.StartRun(this); Reset(); }
private static void OnSignInCompleted(object sender, SignInCompletedEventArgs e) { SaveDataHandler.ResetCache(); StatTracker.LoadAsync(); if (!(Engine.Room is RoomMain) && !(Engine.Room is RoomInit)) { Engine.ChangeRoom <RoomMain>(); } }
public void Awake() { st = GameObject.Find("StatTracker").GetComponent <StatTracker>(); if (GameEndScreen) { Text timeScore = GameObject.Find("TimeScore").GetComponent <Text>(); timeScore.text = st.ReturnCount(); } }
void Start() { try{ statTracker = GameObject.FindGameObjectWithTag("stat_tracker").GetComponent <StatTracker>(); } catch {} anim = transform.gameObject.GetComponent <Animator>(); aux = transform.gameObject.GetComponent <AudioSource>(); if (roar != null) { nextRoar = Random.Range(10f, 30f); } }
private void Awake() { if (Instance) { Debug.LogWarning("StatTracker already in scene. Deleting myself!"); Destroy(this); return; } Instance = this; }
private void Awake() { if (inst != null) { Destroy(this); return; } statTracker = gameObject.AddComponent <StatTracker>(); levelManager = gameObject.AddComponent <LevelManager>(); DontDestroyOnLoad(gameObject); }
private static void OnSignOutCompleted(object sender, SignOutCompletedEventArgs e) { XboxLiveObject.CurrentUser = null; XboxLiveObject.CurrentContext = null; SaveDataHandler.ResetCache(); StatTracker.Reset(); if (!(Engine.Room is RoomMain) && !(Engine.Room is RoomInit)) { Engine.ChangeRoom <RoomMain>(); } XboxLiveObject.SignOutCompleted?.Invoke(sender, e); }
public StatTracker[] getStats() { StatTracker[] finalStats = new StatTracker[4]; for (int i = 0; i < 4; i++) { if (active[i]) { finalStats[i] = stats[i]; } } return(finalStats); }
//Events // Use this for initialization void Start() { alive = false; playerVisible = false; player = GameObject.FindGameObjectWithTag("Player"); stats = this.GetComponent <StatTracker>(); direction = Vector2.zero; sword = GameObject.Find("BossSword"); sheath = GameObject.Find("BossSheath"); sword.GetComponent <Renderer>().enabled = false; attacking = false; }
public static void sendMessage(ICollection <Player> recievers, StatTracker statTracker) { RawMessage bigMsg = new RawMessage(); bigMsg.putInt("id", TypeIdGenerator.getMessageId(typeof(GEndGameStatisticsResult))); bigMsg.putInt("c", statTracker.playerStatsList.Count); int[] playerIDs = new int[statTracker.playerStatsList.Count]; int [] minionsKilled = new int[statTracker.playerStatsList.Count]; int[] minionsSend = new int[statTracker.playerStatsList.Count]; int[] towersBuilt = new int[statTracker.playerStatsList.Count]; int[] missilesFired = new int[statTracker.playerStatsList.Count]; int[] minionsPassed = new int[statTracker.playerStatsList.Count]; float[] moneyEarned = new float[statTracker.playerStatsList.Count]; float[] moneySpend = new float[statTracker.playerStatsList.Count]; int[] cashs = new int[statTracker.playerStatsList.Count]; int[] incomes = new int[statTracker.playerStatsList.Count]; for (int i = 0; i < statTracker.playerStatsList.Count; i++) { playerIDs[i] = statTracker.playerStatsList[i].ownerPlayer.id; minionsKilled[i] = statTracker.playerStatsList[i].minionsKilled; minionsSend[i] = statTracker.playerStatsList[i].minionsSend; towersBuilt[i] = statTracker.playerStatsList[i].towersBuilt; missilesFired[i] = statTracker.playerStatsList[i].missilesFired; minionsPassed[i] = statTracker.playerStatsList[i].minionsPassed; moneyEarned[i] = statTracker.playerStatsList[i].moneyEarned; moneySpend[i] = statTracker.playerStatsList[i].moneySpend; cashs[i] = statTracker.playerStatsList[i].cash; incomes[i] = statTracker.playerStatsList[i].income; } bigMsg.putIntArray("pids", playerIDs); bigMsg.putIntArray("mk", minionsKilled); bigMsg.putIntArray("ms", minionsSend); bigMsg.putIntArray("tb", towersBuilt); bigMsg.putIntArray("mf", missilesFired); bigMsg.putIntArray("mp", minionsPassed); bigMsg.putFloatArray("mme", moneyEarned); bigMsg.putFloatArray("mms", moneySpend); bigMsg.putIntArray("cs", cashs); bigMsg.putIntArray("inc", incomes); foreach (Player p in recievers) { p.user.session.client.SendMessage(bigMsg); } }
// Initialize the singleton instance. private void Awake() { // If there is not already an instance of SoundManager, set it to this. if (Instance == null) { Instance = this; } //If an instance already exists, destroy whatever this object is to enforce the singleton. else if (Instance != this) { Destroy(gameObject); } //Set SoundManager to DontDestroyOnLoad so that it won't be destroyed when reloading our scene. DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start() { UI = GameObject.Find("Canvas"); Camera.main.GetComponent <CameraController>().keepTransform = this.transform; Camera.main.GetComponent <CameraController>().seekKeep = true; tb = GameObject.Find("Terrain").GetComponent <TerrainBuilder>(); try{ statTracker = GameObject.FindGameObjectWithTag("stat_tracker").GetComponent <StatTracker>(); } catch {} escButton = GameObject.Find("Quit"); escButton.SetActive(false); resourceIndicator = UI.transform.Find("Info_Panel/Resources").GetComponent <Text>(); spawnCountIndicator = UI.transform.Find("Info_Panel/Unit_Cap_Control/Respawn").GetComponent <Text>(); spawnTimerIndicator = UI.transform.Find("Info_Panel/Unit_Cap_Control/SpawnCountdown").GetComponent <Text>(); unitPanel[0] = UI.transform.Find("Unit_Panel/Unit0").GetComponent <Button>(); unitPanel[1] = UI.transform.Find("Unit_Panel/Unit0_0").GetComponent <Button>(); unitPanel[2] = UI.transform.Find("Unit_Panel/Unit0_1").GetComponent <Button>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Target") { atTarget = true; rb.bodyType = RigidbodyType2D.Kinematic; gameObject.transform.SetParent(collision.gameObject.transform); PlayRandomSound(hitSound); } else { StatTracker.ThrowFailed(); PlaySound(failSound); } }
public void SetupLevel(CameraController camera, Player player) { this.mainCamera = camera; //Pass the camera reference to each trigger foreach (CameraTrigger trigger in cameraTriggers) { trigger.MainCamera = mainCamera; } latestCheckPoint = playerStart; this.player = player; this.player.transform.position = latestCheckPoint.Position; this.player.Death += new Player.PlayerEventHandler(ResetLevel); this.statTracker = new StatTracker(); this.statTracker.StartRun(); }
// Start is called before the first frame update void Start() { m_poolObjs = new List <GameObject>(); if (m_AchievementManager == null) { m_AchievementManager = FindObjectOfType <AchievementManager>(); } if (m_st == null) { m_st = FindObjectOfType <StatTracker>(); } Message.text = "Click on a Weapon to Show it's Stats."; initializePool(); ShowOverallStats(); }
// Start is called before the first frame update void Awake() { if (m_instance == null) { m_instance = this; SceneManager.sceneLoaded += onSceneLoad; LoadStats(); } else if (m_instance != this) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); }
void Start() { // Calculates the ball spawning range based on the screen resolution float ballzRadius = (transform.localScale.x / 2f); float spawnHeight = (Camera.main.orthographicSize) - ballzRadius - 1.3f; // Subtracting 1.3 to adjust for the UI float spawnWidth = (spawnHeight * Screen.width / Screen.height) - ballzRadius; spawnValue = new Vector2(spawnWidth, spawnHeight); bonusTime = 0; statTimer = 0.0f; stats = new StatTracker(); // Set to first level level = 1; lc = GetComponent <LevelController> (); lc.SetLevel(level); // hs = GetComponent<HighScore> (); gameOver = false; noBallz = true; isShielded = false; isFrozen = false; isDoublePoints = false; // timeToAnswerIncrement = 0; // timeToAnswerInitial = 0; // timeToAnswerTotal = 0; ResetScore(); // Sets score to 0 ResetProgress(); // Sets correct progress clicks to 0 ResetCombo(); // Sets the starting combo to 1x ResetHealth(); //DisableDoublePoints (); timer = timerValue; // Sets the timer to its starting value timerSlider.maxValue = timerValue; timerSlider.value = timerSlider.maxValue; levelText = levelTransition.GetComponentInChildren <Text> (); TransitionLevel(); // Brings up first level card }
public override void Load() { base.Load(); // setting general plugin globals m_statTracker = m_core.GetStatTracker(); m_guinan = m_core.GetGuinan(); m_d3d = m_core.GetD3D(); m_componentManager = GlobalVariables.componentManager; m_mainForm = m_core.GetMainForm(); m_tray = m_core.GetTrayIcon(); // specific globals m_directoryLocation = "CustomAchievements"; List<ImageFile> ImageFileList = FindImageFilenames(); SetAchievementImages(ImageFileList); }
void Start() { StatTracker st = GameObject.FindObjectOfType <StatTracker>(); gameOverText.text = string.Format( "Game Over!\n\nScore: {0:N0}\nLetters typed: {1:N0}/{5:N0} ({8:N2}%)\nWords typed: {2:N0}/{6:N0} ({9:N2}%)\nMistypes: {3:N0}\nAccuracy: {7:N2}%\nHighest streak: {4:N0}", st.Score, st.LettersTyped, st.WordsTyped, st.TotalFails, st.HighestStreak, st.LettersSpawned, st.WordsSpawned, st.Accuracy, (st.LettersTyped / (float)st.LettersSpawned) * 100f, (st.WordsTyped / (float)st.WordsSpawned) * 100f); Destroy(st.gameObject); }
// Plugin Override Methods public override void Load() { base.Load(); try { m_statTracker = m_core.GetStatTracker(); m_d3d = m_core.GetD3D(); m_guinan = m_core.GetGuinan(); m_achievementComponent = (AchievementComponents)GlobalVariables.componentManager.GetComponent(new Guid("37ea2da1-63d7-4526-844c-9c4d0eda22b9")); //Setup the appServer if (!m_appServer.Setup(2100)) //Setup with listening port { m_core.GetTrayIcon().DisplayToolTip("ERROR", "Error While Loading WS Server"); return; } m_appServer.NewMessageReceived += (appServer_NewMessageReceived); m_appServer.NewSessionConnected += m_appServer_NewSessionConnected; m_appServer.SessionClosed += m_appServer_SessionClosed; //Try to start the appServer if (!m_appServer.Start()) { m_core.GetTrayIcon().DisplayToolTip("ERROR", "Error While Starting WS Server"); return; } m_statTracker.GetEventLog().ListChanged += EventLogChanged; } catch(Exception e) { m_core.GetTrayIcon().DisplayToolTip("ERROR WHILE LOADING: ",e.Message); } }
public void Update() { if (m_GameProcess == null || m_GameProcess.HasExited) { m_GameProcess = null; Active = false; if (Reader != null) { Reader.CloseHandle(); Reader = null; } /*if (m_Injector != null) { m_Injector.Dispose(); m_Injector = null; }*/ var s_Processes = Process.GetProcessesByName("HITMAN"); if (s_Processes.Length == 0) return; // We always select the first process. m_GameProcess = s_Processes[0]; // Setup our Memory Reader. Reader = new ProcessMemoryReader(m_GameProcess); try { if (Reader.OpenProcess()) { m_SkipUpdates = 0; Active = true; // Create our injector and inject our stat module. m_Injector = new Injector(m_GameProcess, false); m_Injector.InjectLibrary("HM3.dll"); // Setup our main control. MainApp.MainWindow.Dispatcher.Invoke(() => { Control = new MainControl(); }); // Setup our engine-specific classes. StatTracker = new StatTracker(this); TimeTracker = new TimeTracker(this); // Update level labels. CurrentLevel = "No Level"; CurrentLevelScene = "No Level"; InGame = false; // Set our control in the main window. InitMenuItems(); MainApp.MainWindow.SetEngineControl(Control, m_MenuItems); } } catch (Exception) { m_GameProcess = null; Active = false; } } if (!Active) return; // Update our trackers. TimeTracker.Update(); StatTracker.Update(); // Set game time. if (StatTracker.CurrentStats.m_Time > 0 || !InGame) Control.SetCurrentTime(StatTracker.CurrentStats.m_Time); else Control.SetCurrentTime(TimeTracker.CurrentTime); }