static void Main() { CWeatherData weatherDataIn = new CWeatherData(); CWeatherData weatherDataOut = new CWeatherData(); Display display = new Display(weatherDataIn, weatherDataOut); weatherDataIn.RegisterObserver(display, 2); weatherDataOut.RegisterObserver(display, 2); StatsDisplay statsDisplay = new StatsDisplay(weatherDataIn, weatherDataOut); weatherDataIn.RegisterObserver(statsDisplay, 0); weatherDataOut.RegisterObserver(statsDisplay, 1); StatsDisplay statsDisplay1 = new StatsDisplay(weatherDataIn, weatherDataOut); weatherDataOut.RegisterObserver(statsDisplay1, 0); weatherDataIn.SetMeasurements(3, 0.7, 760); weatherDataOut.SetMeasurements(4, 0.8, 761); weatherDataOut.RemoveObserver(statsDisplay); weatherDataIn.SetMeasurements(10, 0.8, 761); weatherDataOut.SetMeasurements(-10, 0.8, 761); }
public void TestTwoObservable() { var weatheDataOut = new WeatherDataInside(LocationKind.Outside); var weatheDataIn = new WeatherDataInside(LocationKind.Inside); var display = new Display(weatheDataIn, weatheDataOut, 2); var statsDisplay = new StatsDisplay(weatheDataIn, weatheDataOut, 2); weatheDataOut.SetMeasurements(3, 0.7, 760); Assert.AreEqual(LocationKind.Outside, display.GetLastWeatherStation().GetLocation()); Assert.AreEqual(LocationKind.Outside, statsDisplay.GetLastWeatherStation().GetLocation()); Assert.AreEqual(3, display.GetCurrentTemperature()); Assert.AreEqual(0.7, display.GetCurrentHumidity()); Assert.AreEqual(760, display.GetCurrentPressure()); Assert.AreEqual(3, statsDisplay.GetStatisticInfoDictionary() ["temperature"].GetMaxValue()); Assert.AreEqual(0.7, statsDisplay.GetStatisticInfoDictionary() ["humidity"].GetMaxValue()); Assert.AreEqual(760, statsDisplay.GetStatisticInfoDictionary() ["pressure"].GetMaxValue()); weatheDataIn.SetMeasurements(10, 0.8, 761); Assert.AreEqual(10, display.GetCurrentTemperature()); Assert.AreEqual(0.8, display.GetCurrentHumidity()); Assert.AreEqual(761, display.GetCurrentPressure()); Assert.AreEqual(10, statsDisplay.GetStatisticInfoDictionary() ["temperature"].GetMaxValue()); Assert.AreEqual(0.8, statsDisplay.GetStatisticInfoDictionary() ["humidity"].GetMaxValue()); Assert.AreEqual(761, statsDisplay.GetStatisticInfoDictionary() ["pressure"].GetMaxValue()); Assert.AreEqual(LocationKind.Inside, display.GetLastWeatherStation().GetLocation()); Assert.AreEqual(LocationKind.Inside, statsDisplay.GetLastWeatherStation().GetLocation()); weatheDataOut.SetMeasurements(3, 0.7, 760); Assert.AreEqual(LocationKind.Outside, display.GetLastWeatherStation().GetLocation()); Assert.AreEqual(LocationKind.Outside, statsDisplay.GetLastWeatherStation().GetLocation()); }
public static void Destroy() { stats = null; Stage.RemoveAllChildren(); Stage = null; Root = null; Programs.Clear(); }
public static void DrawAll(List <Player> playersList, Board board, Square[] squareArray) { Console.Clear(); StatsDisplay.ShowStats(playersList); board.Draw(squareArray); DrawPlayers(playersList, squareArray); }
void Start() { spawned = false; // this.exitButton.transform.position = new Vector3(-10, -10, 10); //change to z later difficultyFactor = 1; scrollStartX = this.scrollBar.position.x; statsDisplay = GameObject.Find("StatsDisplay"); stats = statsDisplay.GetComponent <StatsDisplay>(); }
static void Main(string [] args) { WeatherData.WeatherData weatheDataOut = new WeatherData.WeatherData(Observer.LocationKind.Outside); WeatherData.WeatherData weatheDataIn = new WeatherData.WeatherData(Observer.LocationKind.Inside); Display display = new Display(weatheDataIn, weatheDataOut, 1); StatsDisplay statsDisplay = new StatsDisplay(weatheDataIn, weatheDataOut, 2); weatheDataOut.SetMeasurements(3, 0.7, 760); weatheDataIn.SetMeasurements(10, 0.8, 761); }
void Pause() { PauseMenuUI.SetActive(true); Time.timeScale = 0f; GameIsPaused = true; PlayerScript playerData = GameObject.Find("PlayerNalp").GetComponent <PlayerScript>(); Player player = playerData.player; StatsDisplay display = statsMenu.GetComponent <StatsDisplay>(); display.setLabels(player.Hp, player.Strength, player.Resistance, player.Speed, player.Level); }
public void TestThreeObservable() { var weatheDataOut = new WeatherDataInside(LocationKind.Outside); var weatheDataIn = new WeatherDataInside(LocationKind.Inside); var display = new Display(weatheDataIn, weatheDataOut, 2); var statsDisplay = new StatsDisplay(weatheDataIn, weatheDataOut, 2); var weatherDataOut2 = new WeatherDataInside(LocationKind.Outside); weatherDataOut2.RegisterObserver(display, 4); weatherDataOut2.RegisterObserver(statsDisplay, 2); }
static void Main(string [] args) { WeatherData.WeatherData wd = new WeatherData.WeatherData(); StatsDisplay statsDisplay = new StatsDisplay(); Display display = new Display(); wd.RegisterObserver(display, 5); wd.RegisterObserver(statsDisplay, 4); wd.SetMeasurements(3, 0.7, 760, 10, 90); wd.SetMeasurements(4, 0.8, 761, 8, 100); }
static void Main(string [] args) { WeatherDataOutside weatheDataOut = new WeatherDataOutside(); WeatherDataInside weatheDataIn = new WeatherDataInside(); Display display = new Display(weatheDataIn, weatheDataOut, 1); StatsDisplay statsDisplay = new StatsDisplay(weatheDataIn, weatheDataOut, 0); weatheDataOut.SetMeasurements(3, 0.7, 760, 10, 90); weatheDataIn.SetMeasurements(10, 0.4, 661); weatheDataOut.SetMeasurements(4, 0.8, 761, 8, 100); }
// Start is called before the first frame update void Start() { // Run the game at 60 fps Application.targetFrameRate = 60; shellen = 0; conversionRate = 2f; shellenPerSecond = 0; shellenPerClick = 1; timeElapsed = 0; statsDisplay = statsDisplayObject.GetComponent <StatsDisplay>(); }
void Start() { camera = FindObjectOfType <Camera>(); animator = GetComponent <Animator>(); obstaclesController = GetComponent <NewCollider2D>(); GetComponent <SpriteRenderer>().flipX = faceDir == -1; statsDisplay = Instantiate(statsDisplay); statsDisplayComponent = statsDisplay.GetComponent <StatsDisplay>(); minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(GM.gravity) * 7.8f); }
/// <summary> /// Sets the player visibility. /// </summary> /// <param name="statsGroup">Stats group.</param> /// <param name="joined">If set to <c>true</c> joined.</param> void SetPlayerVisibility(StatsDisplay statsGroup, bool joined, int playPos) { if (joined) { statsGroup.gameObject.SetActive(true); statsGroup.GPA.text = "" + GPAs[playPos]; statsGroup.classStanding.text = "" + standings[playPos]; statsGroup.playerName.text = "" + playerNames[playPos]; } else { statsGroup.gameObject.SetActive(false); } }
public ObserverPatternRunner() { rnd = new Random(); display = new ForecastDisplay(); general = new GeneralDisplay(); stats = new StatsDisplay(); station = new WeatherStation(); data = new WeatherData(); station.AddObserver(display); station.AddObserver(general); station.AddObserver(stats); station.State = data; }
static void Main(string[] args) { var wdIn = new WeatherData(); var wdOut = new WeatherDataPro(); var display = new Display(wdIn, wdOut); var statsDisplay = new StatsDisplay(wdIn, wdOut); wdIn.UpdateWeatherInfo(3, 0.7, 760); wdIn.UpdateWeatherInfo(4, 0.8, 761); wdOut.UpdateWeatherInfo(4, 0.8, 761, 90, 11); wdOut.UpdateWeatherInfo(4, 0.8, 761, 270, 10); wdIn.RemoveObserver(statsDisplay); wdOut.RemoveObserver(statsDisplay); wdIn.UpdateWeatherInfo(10, 0.8, 761); }
static void Main(string[] args) { var wd = new WeatherData(); var display = new Display(); wd.RegisterObserver(display, priority: 5); var statsDisplay = new StatsDisplay(); wd.RegisterObserver(statsDisplay, priority: 4); wd.UpdateWeatherInfo(3, 0.7, 760, 10, 1); wd.UpdateWeatherInfo(4, 0.8, 761, 350, 1); wd.RemoveObserver(statsDisplay); wd.UpdateWeatherInfo(10, 0.8, 761, 135, 66); wd.UpdateWeatherInfo(-10, 0.8, 761, 180, 88); }
static void Main() { CWeatherData wd = new CWeatherData(); Display display = new Display(); wd.RegisterObserver(display, 1); StatsDisplay statsDisplay = new StatsDisplay(); wd.RegisterObserver(statsDisplay, 0); wd.SetMeasurements(3, 0.7, 760, 4, 60); wd.SetMeasurements(4, 0.8, 761, 2, 90); wd.RemoveObserver(display); wd.SetMeasurements(10, 0.7, 760, 4, 270); wd.SetMeasurements(-10, 0.8, 761, 8, 180); }
/// <summary> /// Shows a small debug statistic overlay on one of the corners. /// </summary> public static void ShowStats(HorizontalAlignment horizontalAlign = HorizontalAlignment.Left, VerticalAlignment verticalAlign = VerticalAlignment.Top, float scale = 1f) { float stageWidth = Stage.Width; float stageHeight = Stage.Height; if (_statsDisplay == null) { _statsDisplay = new StatsDisplay(); //_statsDisplay.Touchable = false; } Stage.AddChild(_statsDisplay);// TODO now things can be added above it, prevent this _statsDisplay.ScaleX = _statsDisplay.ScaleY = scale; if (horizontalAlign == HorizontalAlignment.Left) { _statsDisplay.X = 0f; } else if (horizontalAlign == HorizontalAlignment.Right) { _statsDisplay.X = stageWidth - _statsDisplay.WidthScaled; } else if (horizontalAlign == HorizontalAlignment.Center) { _statsDisplay.X = (stageWidth - _statsDisplay.WidthScaled) / 2; } if (verticalAlign == VerticalAlignment.Top) { _statsDisplay.Y = 0f; } else if (verticalAlign == VerticalAlignment.Bottom) { _statsDisplay.Y = stageHeight - _statsDisplay.HeightScaled; } else if (verticalAlign == VerticalAlignment.Center) { _statsDisplay.Y = (stageHeight - _statsDisplay.HeightScaled) / 2; } }
public async Task DashControllerStatsTest() { var data = new HomeApiDataHandler(); var display = new StatsDisplay { Tenant = TenantData.GetFirstDisplay(), Meetings = new List <MeetingDisplay>() { MeetingData.GetFirstDisplay(false) }, Msgs = new List <MsgDisplay>() { MsgData.GetFirstDisplay(false) }, }; data.Result.Setup(m => m.Execute(It.IsAny <StatsComposite>())).Returns(display); var controller = new DashController(data, Logic) { CurrentUser = StandardUser }; var result = await controller.Stats() as OkObjectResult; result.Should().NotBeNull(); result.Should().BeOfType <OkObjectResult>(); result.Value.Should().NotBeNull(); var check = result.Value as StatsViewModel; check.Should().NotBeNull(); check.Meetings.Count().Should().Be(0); check.Messages.Count().Should().Be(0); check.Success.Should().BeTrue(); Assert.That(check.Tenant, Is.DeepEqualTo(display.Tenant)); data.HasExecuted.Should().BeTrue(); data.Result.Verify(s => s.Execute(It.IsAny <StatsComposite>()), Times.Once()); }
/// <summary> /// Will create all of the required components to make the game playable /// </summary> /// <param name="game">The game instance</param> /// <param name="spriteBatch">The spritebatch to draw it to</param> public ActionScene(Game game, SpriteBatch spriteBatch) : base(game) { this.spriteBatch = spriteBatch; //Get our textures for our objects Texture2D sbTex = game.Content.Load <Texture2D>("Images/spacebk2"); playerTex = game.Content.Load <Texture2D>("Images/player"); displayFont = game.Content.Load <SpriteFont>("Fonts/RegularFont"); //Get our sound effects and add them to the soundeffects dictionary SoundEffect playerBulletSoundEffect = game.Content.Load <SoundEffect>("SoundEffects/PlayerLaser"); SoundEffect explosionSoundEffect = game.Content.Load <SoundEffect>("SoundEffects/Explosion"); SoundEffect playerHitSoundEffect = game.Content.Load <SoundEffect>("SoundEffects/PlayerHit"); soundEffects.Add("PlayerBullet", playerBulletSoundEffect); soundEffects.Add("Explosion", explosionSoundEffect); soundEffects.Add("PlayerHit", playerHitSoundEffect); //Create the positions for our objects Vector2 backgroundPos1 = new Vector2(0, 0); Vector2 backgroundPos2 = new Vector2(0, -Shared.stage.Y); Vector2 backgroundSpeed = new Vector2(0, 4); Vector2 playerPos = new Vector2(Shared.stage.X / 2 - playerTex.Width, Shared.stage.Y / 2 - playerTex.Height); Vector2 playerSpeed = new Vector2(10, 10); //Create the game objects scrollingBackground = new ScrollingItem(game, spriteBatch, sbTex, backgroundPos1, backgroundPos2, backgroundSpeed); playerSpaceShip = new Player(game, spriteBatch, playerTex, playerPos, playerSpeed); enemyManager = new EnemyManager(game, spriteBatch, enemies); scorePosition = new Vector2(Shared.stage.X - 150, 0); statsDisplay = new StatsDisplay(game, spriteBatch, displayFont); //Add them to list of components this.Components.Add(scrollingBackground); this.Components.Add(playerSpaceShip); this.Components.Add(enemyManager); this.Components.Add(statsDisplay); }
public void Awake() { if (Instance != null) { Destroy(gameObject); return; } else { Instance = this; } if (PlayerPrefs.HasKey(PrefsKeys.STATS)) { BaseStats = JsonUtility.FromJson <Stats>(PlayerPrefs.GetString(PrefsKeys.STATS)); } if (BaseStats.PicturePath != "") { CharacterImage.sprite = Sprite.Create(Resources.Load <Texture2D>(BaseStats.PicturePath), CharacterImage.rectTransform.rect, CharacterImage.rectTransform.pivot); } }
public string DisplayStat(StatsDisplay sD) { switch (sD) { case (StatsDisplay.MaxHP): return(creature.hitPointMax.ToString()); case (StatsDisplay.HPOutOfMax): return(string.Format("{0} / {1}", creature.hitPoints, creature.hitPointMax)); case (StatsDisplay.Name): return(creature.name); case (StatsDisplay.AmountMoved): return(creature.amountMoved.ToString()); case (StatsDisplay.StatStr): return(string.Format("STR: {0} (+{1})", creature.stats[Stats.Strength], creature.StatMod(Stats.Strength))); case (StatsDisplay.StatDex): return(string.Format("DEX: {0} (+{1})", creature.stats[Stats.Dexterity], creature.StatMod(Stats.Dexterity))); case (StatsDisplay.StatCon): return(string.Format("CON: {0} (+{1})", creature.stats[Stats.Constitution], creature.StatMod(Stats.Constitution))); case (StatsDisplay.StatInt): return(string.Format("INT: {0} (+{1})", creature.stats[Stats.Intelligence], creature.StatMod(Stats.Intelligence))); case (StatsDisplay.StatWis): return(string.Format("WIS: {0} (+{1})", creature.stats[Stats.Wisdom], creature.StatMod(Stats.Wisdom))); case (StatsDisplay.StatCha): return(string.Format("CHA: {0} (+{1})", creature.stats[Stats.Charisma], creature.StatMod(Stats.Charisma))); } return("N/A"); }
private void Awake() { _statsUI = GetComponent <StatsDisplay>(); _motor = GetComponent <CameraMotor_test>(); }
public static void AddChangeListener(StatsDisplay listener) { _changeListeners.Add(listener); }
public void Start() { statsDisplay = GetComponent <StatsDisplay>(); }
public void Awake() { UIDisplay = GameObject.Find("UIDisplay"); statsDisplay = UIDisplay.GetComponent <StatsDisplay>(); gameController = GameObject.Find("GameController").GetComponent <GameController>(); }