private void Awake() { _baseTransform = transform.Find("Base"); if (spriteRenderer != null) { _tintMaterial = spriteRenderer.material; } if (_shieldCollier != null && GetShield() > 0) { _shieldCollier.enabled = true; } if (_collider != null) { _collider.enabled = GetShield() <= 0; } _healthLevel = GameDataController.GetPlayerHealthLevel(); _shieldArmor = GameDataController.GetPlayerShieldArmor(); SetHealthLevel(_healthLevel); SetEquippedShieldArmor(_shieldArmor); }
Color GetHealthColor(HealthLevel level) { switch (level) { case HealthLevel.SuperStrong: return(Color.green); case HealthLevel.Strong: return(Color.blue); case HealthLevel.Ok: return(Color.cyan); case HealthLevel.Injured: return(Color.yellow); case HealthLevel.Weak: return(Color.cyan); case HealthLevel.Fumes: return(Color.red); case HealthLevel.Zombie: return(Color.red); } return(Color.red); }
string GetHealthStatusText(HealthLevel level) { switch (level) { case HealthLevel.SuperStrong: return("SuperStrong"); case HealthLevel.Strong: return("Strong"); case HealthLevel.Ok: return("Ok"); case HealthLevel.Injured: return("Injured"); case HealthLevel.Weak: return("Weak"); case HealthLevel.Fumes: return("Fumes"); case HealthLevel.Zombie: return("Zombie"); } return("Dead"); }
public void TakeDamage_Attacked_HealthEqual() { HealthLevel health = new HealthLevel(); health.currentHealth = 5; health.TakeDamage(5); Assert.AreEqual(0, health.currentHealth); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); HealthLevel healthLevel = target as HealthLevel; GUILayout.BeginHorizontal(); GUILayout.Label("Health:"); GUILayout.TextField(healthLevel.level.ToString()); GUILayout.EndHorizontal(); }
public MonitorPanel(DataCollectorAdapter dataCollectorAdapter, HealthLevel healthLevel, int yScale) { _dataCollectorAdapter = dataCollectorAdapter; _healthLevel = healthLevel; InitializeComponent(); graph1.Interval = dataCollectorAdapter.Interval; graph1.YScale = yScale; CounterName = dataCollectorAdapter.Name; Description = dataCollectorAdapter.Description; worker = new Thread(RunWorker); }
private void SetMaxLifeToMedium() { healthLevel = HealthLevel.Mid; currentMaxHealth = healthThresholdMid; if (particlesThresholdMid) { particlesThresholdMid.SetActive(true); } if (onHealthThreshold != null) { onHealthThreshold(); } }
private void SetMaxLifeToLow() { healthLevel = HealthLevel.Low; currentMaxHealth = healthThresholdLow; if (particlesThresholdMid) { particlesThresholdLow.SetActive(true); } if (onHealthThreshold != null) { onHealthThreshold(); } }
//This method is used to check whether collision happen void OnTriggerEnter(Collider other) { //Generate explosion effect of asteroid when collision happen Instantiate(explosion, transform.position, transform.rotation); //If asteroid collide with player's ship if (other.tag == "Player") { //Generate explosion effect of player's ship Instantiate(explosion, other.transform.position, other.transform.rotation); Destroy(gameObject); GameObject playerObject = GameObject.FindWithTag("Player"); if (playerObject != null) { healthLevel = playerObject.GetComponent <HealthLevel>(); } if (playerObject == null) { Debug.Log("Cannot find 'HealthLevel' script"); } //player's ship take damage of 5 healthLevel.TakeDamage(5); healthLevel.UpdateHealth(); //end the game and destroy player's ship when health is below 0 if (healthLevel.currentHealth <= 0) { other.gameObject.GetComponent <PlayerController> ().alive = false; //Buttons to show up, restart and mainmenu Destroy(other.gameObject); gameController.GameOver(); Time.timeScale = 0; //The asteroids will stop spawning } } //If asteroid collide with player's bullets else { Destroy(other.gameObject); Destroy(gameObject); } gameController.AddScore(scoreValue); //Adds score once object is hit }
public BucketMonitorPanel(DataCollectorAdapter dataCollectorAdapter, HealthLevel healthLevel, Bucket bucket) { this.dataCollectorAdapter = dataCollectorAdapter; this.healthLevel = healthLevel; this.bucket = bucket; InitializeComponent(); var mainLayoutTable = new TableLayoutPanel(); mainLayoutTable.ColumnCount = 1; mainLayoutTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); mainLayoutTable.Dock = DockStyle.Fill; textPanel = new TextPanel(StringAlignment.Center); if (String.IsNullOrEmpty(dataCollectorAdapter.Name)) { mainLayoutTable.RowCount = 1; mainLayoutTable.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); } else { mainLayoutTable.RowCount = 2; mainLayoutTable.RowStyles.Add(new RowStyle(SizeType.Percent, 80F)); mainLayoutTable.RowStyles.Add(new RowStyle(SizeType.Percent, 20F)); textPanel.BackColor = ColorCoderUnknown.Instance.BackColor; textPanel.Dock = DockStyle.Fill; textPanel.ForeColor = Color.White; textPanel.Margin = new Padding(0, 2, 0, 0); textPanel.Text = dataCollectorAdapter.Name; mainLayoutTable.Controls.Add(textPanel, 0, 1); } this.bucket.Dock = DockStyle.Fill; this.bucket.BackColor = ColorCoderUnknown.Instance.BackColor; this.bucket.ForeColor = ColorCoderUnknown.Instance.ForeColor1; this.bucket.ForeColor2 = ColorCoderUnknown.Instance.ForeColor2; mainLayoutTable.Controls.Add(bucket, 0, 0); Controls.Add(mainLayoutTable); worker = new Thread(RunWorker); }
public ColorSignalPanel(DataCollectorAdapter dataCollectorAdapter, HealthLevel healthLevel) { this.dataCollectorAdapter = dataCollectorAdapter; this.healthLevel = healthLevel; InitializeComponent(); worker = new Thread(RunWorker); var tableLayoutPanel = new TableLayoutPanel { Dock = DockStyle.Fill }; tableLayoutPanel.ColumnCount = 1; tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f)); signalPanel.BackColor = ColorCoderUnknown.Instance.BackColor; signalPanel.Dock = DockStyle.Fill; signalPanel.ForeColor = ColorCoderUnknown.Instance.ForeColor1; if (String.IsNullOrEmpty(dataCollectorAdapter.Name)) { tableLayoutPanel.RowCount = 1; tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); } else { tableLayoutPanel.RowCount = 2; tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 80F)); tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 20F)); textPanel = new TextPanel(StringAlignment.Center); textPanel.BackColor = ColorCoderUnknown.Instance.BackColor; textPanel.Dock = DockStyle.Fill; textPanel.ForeColor = ColorCoderUnknown.Instance.ForeColor1; textPanel.Margin = new Padding(0, 2, 0, 0); textPanel.Text = dataCollectorAdapter.Name; tableLayoutPanel.Controls.Add(textPanel, 0, 1); } tableLayoutPanel.Controls.Add(signalPanel, 0, 0); Controls.Add(tableLayoutPanel); }
public GraphMonitorPanel(GraphBase graph, DataCollectorAdapter dataCollectorAdapter, HealthLevel healthLevel) { this.dataCollectorAdapter = dataCollectorAdapter; this.healthLevel = healthLevel; InitializeComponent(); this.graph = graph; this.graph.Dock = DockStyle.Fill; this.graph.BackColor = ColorCoderUnknown.Instance.BackColor; this.graph.ForeColor = ColorCoderUnknown.Instance.ForeColor1; this.graph.ForeColor2 = ColorCoderUnknown.Instance.ForeColor2; mainLayoutTable.Controls.Add(this.graph, 0, 0); CounterName = dataCollectorAdapter.Name; Description = dataCollectorAdapter.Description; worker = new Thread(RunWorker); }
//This method is used to check whether collision happen void OnTriggerEnter(Collider other) { //Generate explosion effect of asteroid when collision happen Instantiate(explosion, transform.position, transform.rotation); //If asteroid collide with player's ship if (other.tag == "Player") { //Generate explosion effect of player's ship Instantiate(explosion, other.transform.position, other.transform.rotation); Destroy(gameObject); GameObject playerObject = GameObject.FindWithTag("Player"); if (playerObject != null) { healthLevel = playerObject.GetComponent <HealthLevel>(); } if (playerObject == null) { Debug.Log("Cannot find 'HealthLevel' script"); } //player's ship take damage of 5 healthLevel.TakeDamage(5); healthLevel.UpdateHealth(); //end the game and destroy player's ship when health is below 0 if (healthLevel.currentHealth <= 0) { Destroy(other.gameObject); gameController.GameOver(); } } //If asteroid collide with player's bullets else { Destroy(other.gameObject); Destroy(gameObject); } }
public void SetHealthLevel(HealthLevel healthLevel) { _healthLevel = healthLevel; switch (healthLevel) { case HealthLevel.Level_1: _health.Value = HEALTH_AMOUNT_PER_SEGMENT; break; case HealthLevel.Level_2: _health.Value = HEALTH_AMOUNT_PER_SEGMENT * 2; break; case HealthLevel.Level_3: _health.Value = HEALTH_AMOUNT_PER_SEGMENT * 3; break; case HealthLevel.Level_4: _health.Value = HEALTH_AMOUNT_PER_SEGMENT * 4; break; } }
private void Awake() { healthLevel = HealthLevel.High; currentMaxHealth = baseMaxHealth; currentHealth = currentMaxHealth; }
public GraphMonitorPanelCompact(GraphBase graph, DataCollectorAdapter dataCollectorAdapter, HealthLevel healthLevel, PipPanel pipPanel) : this(graph, dataCollectorAdapter, healthLevel, pipPanel, null) { }
public GraphMonitorPanel(DataCollectorAdapter dataCollectorAdapter, HealthLevel healthLevel, int yScale) : this(new Graph(false) { YScale = yScale, Interval = dataCollectorAdapter.Interval }, dataCollectorAdapter, healthLevel) { }
/// <summary> /// Gets the health status of the cluster, at the specified level, for the specified indexes. /// </summary> /// <param name="level"></param> /// <returns></returns> public IHealthResponse Health(IEnumerable <string> indices, HealthLevel level) { return(Health(indices, new HealthParams { CheckLevel = level })); }
/// <summary> /// Gets the health status of the cluster, at the specified level. /// </summary> /// <param name="level"></param> /// <returns></returns> public IHealthResponse Health(HealthLevel level) { return(Health(new HealthParams { CheckLevel = level })); }
/// <summary> /// Gets the health status of the cluster, at the specified level, for the specified indexes. /// </summary> /// <param name="level"></param> /// <returns></returns> public IHealthResponse Health(IEnumerable<string> indices, HealthLevel level) { return Health(indices, new HealthParams {CheckLevel = level}); }
/// <summary> /// Gets the health status of the cluster, at the specified level. /// </summary> /// <param name="level"></param> /// <returns></returns> public IHealthResponse Health(HealthLevel level) { return Health(new HealthParams { CheckLevel = level }); }