// --------------------------------------------- // Private // --------------------------------------------- private void TestHitCollision(Vector3 position, CharacterEntity target, bool indicatorOnly) { if (this.HitIndicator != null) { this.gameManager.SpawnHitIndicator(this.HitIndicator, position); } if (indicatorOnly) { return; } if (this.comboChain[this.comboStage].SFXHit != null) { this.GetComponent<AudioSource>().PlayOneShot(this.comboChain[this.comboStage].SFXHit); } this.ResolveCombat(target.gameObject, target); this.allowHit = false; }
protected virtual void ResolveCombat(GameObject target, CharacterEntity targetData) { if (this.hitTest.Contains(target)) { return; } this.hitTest.Add(target); target.GetComponent<StageEntity>().TakeDamage(this.comboChain[this.comboStage].Damage); // Combo knockback from force if (this.comboChain[this.comboStage].Force > 0) { Vector3 direction = (target.transform.position - this.transform.position).normalized; direction.y = 0; target.transform.Translate(direction * this.comboChain[this.comboStage].Force); } }
// ------------------------------------------------------------------- // Private // ------------------------------------------------------------------- private void DrawHealthBar(CharacterEntity target, int progressWidth) { float percent = target.Health / target.MaxHealth; var width = (int)(progressWidth * percent); GUI.DrawTexture(new Rect(this.Border, 0, progressWidth - (this.Border * 2), ProgressHeight), this.EmptyTexture, ScaleMode.StretchToFill); if (percent > 0) { GUI.DrawTexture(new Rect(this.Border, 0, width - (this.Border * 2), ProgressHeight), this.FullTexture, ScaleMode.StretchToFill); } GUI.DrawTexture(new Rect(0, 0, this.LeftTexture.width, ProgressHeight), this.LeftTexture); GUI.DrawTexture(new Rect(progressWidth - this.RightTexture.width, 0, this.RightTexture.width, ProgressHeight), this.RightTexture); }
// ------------------------------------------------------------------- // Protected // ------------------------------------------------------------------- protected override void ResolveCombat(GameObject target, CharacterEntity targetData) { base.ResolveCombat(target, targetData); this.CurrentTarget = target; this.comboDidHit = true; if (targetData.IsDead && targetData as Enemy != null) { this.Score += ((Enemy)targetData).ScoreReward; } }
public void Start() { this.host = this.Parent.GetComponent<CharacterEntity>(); }
protected override void ResolveCombat(GameObject target, CharacterEntity targetData) { base.ResolveCombat(target, targetData); this.comboDidHit = true; }