//Botar animações futuramente public EffectResult OverrideReceiveDamage(SkillInfo skillInfo, DamageEffect damageEffect) { //Não counterar caso não seja de uma skill (como outro counter) if (skillInfo.Skill == null) { return(null); } //Não counterar se for do mesmo time if (BattleController.Instance.IsSameTeam(skillInfo.Source, skillInfo.Target)) { return(null); } //Não counterar se o dano não for do tipo necessario. if (CounterType.HasValue && DamageEffect.DamageType != CounterType.Value) { return(null); } var rng = GameController.Instance.Random.NextDouble(); if (rng < Chance) { return new CounterEffectResult { CounterDamageEffect = DamageEffect, skillInfo = skillInfo } } ; return(null); }
private void Update() { if (Input.GetKeyDown(KeyCode.A)) { DamageEffect.CreateDamageEffect(new Vector3(0, 0, 0), 2); } }
public override void takeDamage(int damage, string damageType = "physical") { //sounds.playSound("defeat"); switch (damageType) { case "physical": var damageMod = (100f - physicalResist) / 100f; damage = (int)Mathf.Round(damage * damageMod); break; case "psychic": damage = (int)Mathf.Round(damage * ((100 - psychicResist) / 100)); break; } /*if(shieldDuration > 0){ * Debug.Log("Shield activated. Damage preshield: " + damage + " shield left: " + shieldDuration); * damage = Mathf.Clamp(damage-shieldAmount,0,1000); * shieldDuration -= 1; * Debug.Log("Shield activated. Damage postshield: " + damage + " shield left: " + shieldDuration); * }*/ health -= damage; DamageEffect.Emit(10); // DamageEffect2.Emit(10); switch (health) { case 2: Healthy.SetActive(false); Damaged.SetActive(true); Damaged2.SetActive(false); break; case 1: Healthy.SetActive(false); Damaged.SetActive(false); Damaged2.SetActive(true); break; case 0: Healthy.SetActive(false); Damaged.SetActive(false); Damaged2.SetActive(false); getDefeated(); break; } //healthBar.SetHealth(health); //UI.showDamage(-damage); //hitIndicator.showHit(); //checks if the damage is enough to knock the character out. If character has points of undying he will lose one instead of dying /* * if(health <= 0){ * /*if(undying > 0){ * undying -= 1; * health = 1; * healthBar.SetHealth(health); * }else{ * getDefeated(); * }*/ }
protected virtual void OnTriggerEnter(Collider colld) { //Return if this can't be damaged if (invincible) { return; } DamageEffect dEf = colld.gameObject.GetComponent <DamageEffect>(); //If no DamageEffect, exit this method if (dEf == null) { return; } //Play EnemyHit sound FindObjectOfType <AudioManager>().PlaySound("EnemyHit"); //Subtract the damage amount from health health -= dEf.damage; if (health <= 0) { Die(); } //Make this invincible invincible = true; invincibleDone = Time.time + invincibleDuration; if (dEf.knockback) //knockback this { knockBack(colld); } }
void Update() { if (Input.GetKeyDown(KeyCode.A)) { DamageEffect.CreateDamageEffect(transform.position, Random.Range(1, 7)); } }
void OnTriggerEnter(Collider coll) { if (invincible) { return; } DamageEffect dEf = coll.gameObject.GetComponent <DamageEffect>(); if (dEf == null) { return; //nothing happens if no damage effect is tied to it. } health -= dEf.damage; invincible = true; invincibleDone = Time.time + invincibleDuration; if (dEf.knockback) { //Direction Vector3 delta = transform.position - coll.transform.position; //apply speed to rigidbody. knockbackVel = delta * knockbackSpeeed; rigid.velocity = knockbackVel; currentMode = mode.knockback; knockbackDone = Time.time + knockbackDuration; } if (coll.gameObject.tag == "Coin") { Debug.Log("Got a Coin!"); Destroy(coll.gameObject); coins += 1; } }
protected void Fire(GameObject target, DamageEffect damage = null) { GameObject projectilePrefab = projectilePrefabs[0]; if (damage != null) { if (damage.DamageTotal > 1) { if (damage.DamageTotal > projectilePrefabs.Count) { projectilePrefab = projectilePrefabs[projectilePrefabs.Count - 1]; } else { projectilePrefab = projectilePrefabs[damage.DamageTotal - 1]; } } } GameObject go = Instantiate(projectilePrefab, shooter.transform.position, Quaternion.identity) as GameObject; Projectile projectile = go.GetComponent<Projectile>(); projectile.Target = target; projectile.Damage = damage; ++currentDamage; if(currentDamage > maxDamage) { currentDamage = minDamage; } }
void OnCollisionEnter(Collision coll) { if (invincible) { return; } DamageEffect dEf = coll.gameObject.GetComponent <DamageEffect>(); if (dEf == null) { return; } health -= dEf.damage; invincible = true; invincibleDone = Time.time + invincibleDuration; if (dEf.knockback) { Vector3 delta = transform.position - coll.transform.position; if (Mathf.Abs(delta.x) >= Mathf.Abs(delta.y)) { delta.x = (delta.x > 0) ? 1 : -1; delta.y = 0; } else { delta.x = 0; delta.y = (delta.y > 0) ? 1 : -1; } knockbackVel = delta * knockbackSpeed; rigid.velocity = knockbackVel; mode = eMode.knockback; knockbackDone = Time.time + knockbackDuration; } }
protected void Fire(GameObject target, DamageEffect damage = null) { GameObject projectilePrefab = projectilePrefabs[0]; if (damage != null) { if (damage.DamageTotal > 1) { if (damage.DamageTotal > projectilePrefabs.Count) { projectilePrefab = projectilePrefabs[projectilePrefabs.Count - 1]; } else { projectilePrefab = projectilePrefabs[damage.DamageTotal - 1]; } } } Vector3 pos = cause.transform.position; pos.y += 15; GameObject go = Instantiate(projectilePrefab, pos, Quaternion.identity) as GameObject; Projectile projectile = go.GetComponent <Projectile>(); projectile.Target = target; projectile.Damage = damage; projectiles.Add(projectile); }
/// <summary> /// Creates the damage effect. /// This is a static method, so it should be called like this: DamageEffect.CreateDamageEffect(transform.position, 5); /// </summary> /// <param name="position">Position.</param> /// <param name="amount">Amount.</param> public static void CreateDamageEffect(Vector3 position, int amount) { if (amount == 0) { return; } // Instantiate a DamageEffect from prefab GameObject newDamageEffect = new GameObject(); newDamageEffect = GameObject.Instantiate(DamageEffectTest.Instance.DamagePrefab, position, Quaternion.identity) as GameObject; // Get DamageEffect component in this new game object DamageEffect de = newDamageEffect.GetComponent <DamageEffect>(); // Change the amount text to reflect the amount of damage dealt if (amount < 0) { // NEGATIVE DAMAGE = HEALING de.AmountText.text = "+" + (-amount).ToString(); de.DamageImage.color = Color.green; } else { de.AmountText.text = "-" + amount.ToString(); } // start a coroutine to fade away and delete this effect after a certain time de.StartCoroutine(de.ShowDamageEffect()); }
void ApplyBaseEffect(Collider mob) { //Debug.Log ("entity entering"); if (slowPercentage > 0) { if (mob.gameObject.GetComponent <SlowEffect> () != null) { if (mob.gameObject.GetComponent <SlowEffect> ().slowPercentage < slowPercentage) { Destroy(mob.gameObject.GetComponent <SlowEffect> ()); ApplySlowEffect(mob); } } else { ApplySlowEffect(mob); } } if (damage > 0) { de = mob.gameObject.AddComponent <DamageEffect> () as DamageEffect; de.damage = damage; de.Apply(); } }
override protected void Update() { base.Update(); if (cause == null) { Remove(); return; } if (currentTarget < targets.Count) { DamageEffect dmg = data.damages[currentTarget]; if (shotTimer > shotDelay) { GameEntity target = targets[currentTarget]; Fire(target.gameObject, dmg); shotTimer = 0; ++shotCounter; ++currentTarget; } else { shotTimer += Time.deltaTime; } } }
/// <summary> /// Creates the damage effect. /// Muestra el daño a la criatura o jugador. /// </summary> /// <param name="position">Position.</param> /// <param name="amount">Amount.</param> public static void CreateDamageEffect(Vector3 position, int health, int amount) { GameObject newDamageEffect = InstanciarPrefab(position); // Get DamageEffect component in this new game object DamageEffect de = newDamageEffect.GetComponent <DamageEffect>(); // Change the amount text to reflect the amount of damage dealt ConfiguracionUsuario settings = ConfiguracionUsuario.Instance; if (settings.ConfiguracionBatalla.Equals(ConfiguracionUsuario.TIPO_CONFIGURACION.ENTERO)) { de.AmountText.text = "-" + amount.ToString(); } //de.AmountText.text = health.ToString()+"-"+amount.ToString(); else if (settings.ConfiguracionBatalla.Equals(ConfiguracionUsuario.TIPO_CONFIGURACION.FRACCION)) { de.AmountText.text = "-" + ConfiguracionUsuario.ObtenerFraccion(amount, health) + "x" + health.ToString(); } else { de.AmountText.text = "-" + ConfiguracionUsuario.ObtenerPorcentaje(amount, health); } //de.AmountText.text = health.ToString()+"-"+Settings.ObtenerFraccion(amount,health)+"x"+health.ToString(); // start a coroutine to fade away and delete this effect after a certain time de.StartCoroutine(de.ShowDamageEffect()); //Comandas.Instance.CompletarEjecucionComanda(); }
public void takeDamage(int damage) { Debug.Log(myLocation); if (damage == 0) { return; } if (myLocation == location.board) { DamageEffect.CreateDamageEffect(myPlayerCard, damage); } else { DamageEffect.CreateDamageEffect(Doctor, damage); } Hp -= damage; setStatusEffectColors(); if (Hp <= 0) { Die(); } }
protected void Fire(GameObject target, DamageEffect damage = null) { GameObject projectilePrefab = projectilePrefabs[0]; if (damage != null) { if (damage.DamageTotal > 1) { if (damage.DamageTotal > projectilePrefabs.Count) { projectilePrefab = projectilePrefabs[projectilePrefabs.Count - 1]; } else { projectilePrefab = projectilePrefabs[damage.DamageTotal - 1]; } } } GameObject go = Instantiate(projectilePrefab, shooter.transform.position, Quaternion.identity) as GameObject; Projectile projectile = go.GetComponent <Projectile>(); projectile.Target = target; projectile.Damage = damage; ++currentDamage; if (currentDamage > maxDamage) { currentDamage = minDamage; } }
// Use this for initialization void Start() { rgdBdy = GetComponent <Rigidbody2D>(); ScrollManager.Instance.StopScroll(); _dmgEffect = gameObject.GetComponent <DamageEffect>(); _animator = gameObject.GetComponent <Animator>(); }
void OnTriggerEnter(Collider colld) { if (invincible) return; // Return if this can't be damaged DamageEffect dEf = colld.gameObject.GetComponent<DamageEffect>(); if (dEf == null) return; // If no DamageEffect, exit this method health -= dEf.damage; // Subtract the damage amount from health if (health <= 0) Die(); invincible = true; // Make this invincible invincibleDone = Time.time + invincibleDuration; if (dEf.knockback) { // Knockback this // Determine the direction of knockback Vector3 delta = transform.position - colld.transform.root.position; if (Mathf.Abs(delta.x) >= Mathf.Abs(delta.y)) { // Knockback should be horizontal delta.x = (delta.x > 0) ? 1 : -1; delta.y = 0; } else { // Knockback should be vertical delta.x = 0; delta.y = (delta.y > 0) ? 1 : -1; } // Apply knockback speed to the Rigidbody knockbackVel = delta * knockbackSpeed; rigid.velocity = knockbackVel; // Set mode to knockback and set time to stop knockback knockback = true; knockbackDone = Time.time + knockbackDuration; anim.speed = 0; } }
public void FillTalents() { TalentData data = new TalentData { Name = "Bash", TalentPrerequisites = new string[0], LevelRequirement = 1, TalentType = TalentType.Activated, ActivationCost = 5, AllowedClasses = new string[] { "Fighter" }, AttributeRequirements = new Dictionary <string, int>() { { "Strength", 10 } } }; DamageEffect effect = DamageEffect.FromDamageEffectData(new DamageEffectData { TargetType = SpellClasses.TargetType.Enemy, AttackType = AttackType.Health, DamageType = DamageType.Crushing, DieType = DieType.D8, Modifier = 2, Name = "Bash", NumberOfDice = 2 }); data.Effects.Add(effect); talentData.Add("Bash", data); data = new TalentData() { Name = "Below The Belt", TalentPrerequisites = new string[0], LevelRequirement = 1, TalentType = TalentType.Activated, ActivationCost = 5, AllowedClasses = new string[] { "Rogue" }, AttributeRequirements = new Dictionary <string, int>() { { "Dexterity", 10 } } }; effect = DamageEffect.FromDamageEffectData(new DamageEffectData() { TargetType = SpellClasses.TargetType.Enemy, AttackType = AttackType.Health, DamageType = DamageType.Piercing, DieType = DieType.D4, Modifier = 2, Name = "Below The Belt", NumberOfDice = 3 }); data.Effects.Add(effect); talentData.Add("Below The Belt", data); }
protected void Fire(GameObject target, DamageEffect damage = null) { GameObject projectilePrefab = projectilePrefabs[0]; if(damage != null) { if(damage.DamageTotal > 1) { if (damage.DamageTotal > projectilePrefabs.Count) { projectilePrefab = projectilePrefabs[projectilePrefabs.Count - 1]; } else { projectilePrefab = projectilePrefabs[damage.DamageTotal - 1]; } } } Vector3 pos = cause.transform.position; pos.y += 15; GameObject go = Instantiate(projectilePrefab, pos, Quaternion.identity) as GameObject; Projectile projectile = go.GetComponent<Projectile>(); projectile.Target = target; projectile.Damage = damage; projectiles.Add(projectile); }
void OnTriggerEnter( Collider colld ) { // d if (invincible) return; // Return if this can't be damaged DamageEffect dEf = colld.gameObject.GetComponent <DamageEffect>(); if (dEf == null) return; // If no DamageEffect, exit this method health -= dEf.damage; // Subtract the damage amount from health if (health <= 0) Die(); // e invincible = true; // Make this invincible invincibleDone = Time.time + invincibleDuration; if (dEf.knockback) { // Knockback this // Determine the direction of knockback Vector3 delta = transform.position - colld.transform.root.position; if (Mathf.Abs(delta.x) >= Mathf.Abs(delta.y)) { // Knockback should be horizontal delta.x = (delta.x > 0) ? 1 : - 1; delta.y = 0; } else { // Knockback should be vertical delta.x = 0; delta.y = (delta.y > 0) ? 1 : - 1; } // Apply knockback speed to the Rigidbody knockbackVel = delta * knockbackSpeed; rigid.velocity = knockbackVel; // Set mode to knockback and set time to stop knockback knockback = true; knockbackDone = Time.time + knockbackDuration; anim.speed = 0; } }
protected void doDamage(DamageEffect effect) { //Debug.Log("DoDamageCalled"); if (triggerManager == null) { return; } IDamagable[] objects = triggerManager.getObjectsInTrigger(); foreach (IDamagable obj in objects) { if (obj.getTeamId() == myManager.teamId) { continue; } //Debug.Log("Opponent found"); PhotonView view = obj.getView(); if (view == null) { Debug.LogError("Player without photon view found!"); } else { if (!obj.isDead()) { view.RPC("takeDamage", PhotonTargets.AllViaServer, myManager.attack * effect.damageModifier * UnityEngine.Random.Range(0.75f, 1.25f), myManager.username); } } } }
} // ---UpdateHp() /* * 攻撃演出処理 */ protected IEnumerator DrawBattleGraphic(BaseCharacter[] cd, ComboManager cm) { // 攻撃者の画像を貼り付ける GameObject atkObj = DamageEffect.DrawAttackChara(this); yield return(Utility._Wait.WaitFrame(30)); Destroy(atkObj); // 対象表示 DamageEffect.TargetGraphicDraw(cd[targetId]); yield return(Utility._Wait.WaitFrame(10)); // 戦闘アニメーション DamageEffect.AttackEffect(1); yield return(Utility._Wait.WaitFrame(45)); // ダメージ表示 DamageEffect.DrawDamage(DamageEffect.CalDamage(this, cm)); DamageEffect.DrawCombo(cm); yield return(Utility._Wait.WaitFrame(45)); // 消去 DamageEffect.DestroyAllObject(); yield return(0); }
//Initialize the variables. void Start() { isDead = false; CurrentHealth = StartingHealth; HealthBar.fillAmount = 1f; dmgEffect = PainEffect.GetComponent <DamageEffect>(); }
public void TakeDamage(int amount, int healthAfter) //metoda przypisująca nową wartość życia { if (amount > 0) //jeśli atak jest większy od 0 { DamageEffect.CreateDamageEffect(transform.position, amount); HealthText.text = healthAfter.ToString(); //przypisanie nowej wartości życia } }
public void TakeDamage(int amount, int healthAfter) { if (amount > 0) { DamageEffect.CreateDamageEffect(transform.position, amount); HealthText.text = healthAfter.ToString(); } }
public static void CreateDamageEffect(Vector3 position, int amount) { GameObject newDamageEffect = GameObject.Instantiate(GlobalSettings.Instance.DamageEffectPrefab, position, Quaternion.identity) as GameObject; DamageEffect DE = newDamageEffect.GetComponent <DamageEffect>(); DE.DamageText.text = "-" + amount.ToString(); DE.StartCoroutine(DE.ShowDamageEffect()); }
public void TakeDamage(int amount, int healthAfter) { if (amount != 0) { DamageEffect.CreateDamageEffect(transform.position, amount); HealthText.text = System.Math.Min(healthAfter, charAsset.MaxHealth).ToString(); } }
public void FillSpellData() { SpellData data = new SpellData() { Name = "Spark Jolt", SpellPrerequisites = new string[0], SpellType = SpellType.Activated, LevelRequirement = 1, ActivationCost = 8, AllowedClasses = new string[] { "Wizard" }, AttributeRequirements = new Dictionary <string, int>() { { "Magic", 10 } } }; BaseEffect effect = DamageEffect.FromDamageEffectData(new DamageEffectData { Name = "Spark Jolt", TargetType = TargetType.Enemy, AttackType = AttackType.Health, DamageType = DamageType.Air, DieType = DieType.D6, NumberOfDice = 3, Modifier = 2 }); data.Effects.Add(effect); spellData.Add("Spark Jolt", data); data = new SpellData() { Name = "Mend", SpellPrerequisites = new string[0], SpellType = SpellType.Activated, LevelRequirement = 1, ActivationCost = 6, AllowedClasses = new string[] { "Priest" }, AttributeRequirements = new Dictionary <string, int>() { { "Magic", 10 } } }; BaseEffect healEffect = HealEffect.FromHealEffectData(new HealEffectData { Name = "Mend", TargetType = TargetType.Self, HealType = HealType.Health, DieType = DieType.D8, NumberOfDice = 2, Modifier = 2 }); data.Effects.Add(healEffect); spellData.Add("Mend", data); }
public void SetProjectileStats(int damage, DamageEffect statusNumber, float speed, float lifetime, float gravity, PlayerStats playerStats) { projectileDamage = damage; projectileDamageStatusNumber = statusNumber; projectileSpeed = speed; projectileLifeTime = lifetime; rigidbodyReference.gravityScale = gravity; ownerStats = playerStats; }
public void TakeDamage(int amount, int healthAfter) { if (amount != 0) { DamageEffect.CreateDamageEffect(transform.position, amount); healthText.text = previewManager.HealthText.text = healthAfter.ToString(); } DebugManager.Instance.DebugMessage(string.Format("{0} takes {1} damage, leaving it at {2}!", cardAsset.name, amount, healthAfter), DebugManager.MessageType.Game); }
public IEnumerator Damage(int damage) { //Card lastCard = null; int d = damage - Defence >= 0 ? damage - Defence : 0; DamageEffect.DamageInit(d, playerImage.gameObject); yield return(StartCoroutine(LifeManager.GetDamage(d, this))); //Constants.BATTLE.CallTrigger(TriggerType.TakeDamage,this); }
public override void TakeAction(GameObject target) { base.TakeAction(target); GameObject myObject = Instantiate(effectPrefab, target.transform.position, Quaternion.identity); DamageEffect effect = myObject.GetComponent <DamageEffect>(); effect.SetAttackPower(character.characterInfo); effect.GetComponent <DamageEffect>().TriggerEffect(); }
private void OnShieldImpact(ShieldImpactMessage obj) { if (!obj.WasDeflected) { CurrentEffect = obj.Projectile.DamageEffect; EffectExpirationTime = Time.time + obj.Projectile.EffectTime; damageAnimation.renderer.enabled = true; damageAnimation.Play(); } }
void Update () { timer += Time.deltaTime; if(timer > delay) { DamageEffect damage = new DamageEffect(); damage.damageTaken = currentDamage; damage.shieldBlocked = Random.Range(minShield, maxShield + 1); Fire(target, damage); timer = 0; } }
protected override void Start() { try { if (_started) return; base.Start(); var parent = transform.parent; MouseController = parent.GetComponent<MouseController>(); TapController = parent.GetComponent<TapController>(); CurrentEffect = DamageEffect.None; damageAnimation.renderer.enabled = false; damageAnimation.Stop(); _started = true; } catch (Exception e) { LogHandler.Handle(e); } }
// 依照部件啟動傷害特效 public string ActiveDamageEffect( GameObject _Attacker , string _ComponentObjName ) { // Debug.Log( "ActiveDamageEffect() " + _ComponentObjName ) ; UnitData unitData = this.gameObject.GetComponent<UnitData>() ; // find correct effect object DamageEffect newDamage = null ; string [] strVec = ConstName.GetSplitVec( _ComponentObjName ) ; if( strVec.Length > 1 && strVec[1] != ConstName.UnitDataComponentUnitIntagraty ) { // it's a component , // active shield effect string ShieldComponentName = strVec[ 1 ] ; if( null != unitData && true == unitData.componentMap.ContainsKey( ShieldComponentName ) && true == unitData.m_ShieldDataSet.ContainsKey( ShieldComponentName ) ) { UnitComponentData componentData = unitData.componentMap[ ShieldComponentName ] ; ComponentDataSet shieldSet = unitData.m_ShieldDataSet[ ShieldComponentName ] ; if( false == componentData.IsOffline() ) { newDamage = new DamageEffect() ; newDamage.m_EffectObj.Setup( shieldSet.Effect3DObject ) ; newDamage.IsDestroyAtEnd = false ; newDamage.Start() ; ObjectShakeEffect shake = shieldSet.Effect3DObject.GetComponent<ObjectShakeEffect>() ; if( null != shake ) { shake.Active( true ) ; } } } } else { // it's unit // active sparks effect string sparksTemplateName = ConstName.EffectSparksTemplateName ; string effectObjName = ConstName.CreateEffectName( this.gameObject.name , sparksTemplateName , true ) ; GameObject effectObj = PrefabInstantiate.CreateByInit( sparksTemplateName , effectObjName , this.gameObject.transform.position , this.gameObject.transform.rotation ) ; // Debug.Log( "ActiveDamageEffect() effectObjName" + effectObjName ) ; if( null == effectObj ) { Debug.Log( "ActiveDamageEffect() null == effectObj=" + sparksTemplateName ) ; return "" ; } // parent effectObj.transform.parent = this.gameObject.transform ; newDamage = new DamageEffect() ; newDamage.m_EffectObj.Setup( effectObj ) ; newDamage.IsDestroyAtEnd = true ; newDamage.Start() ; } string retEffectName = "" ; if( null != newDamage ) { this.m_DamageEffects.Add( newDamage ) ; retEffectName = newDamage.EffectName() ; } // push effect // try add shift effect if( null != unitData ) { Vector3 ToAttacker = this.gameObject.transform.position - _Attacker.transform.position ; ToAttacker.y = 0 ;// do not move in y direction ToAttacker.Normalize() ; // Debug.Log( ToAttacker ) ; ShiftEffect shiftDamage = new ShiftEffect() ; shiftDamage.m_ShiftVec = ToAttacker ; shiftDamage.m_TargetObject = this.gameObject ; shiftDamage.StartByTime(1.0f) ; this.m_DamageEffects.Add( shiftDamage ) ; //*/ } return retEffectName ; }
private void RemoveEffect() { Start(); if (MouseController) { CurrentEffect = DamageEffect.None; MouseController.enabled = true; } if (TapController) { TapController.enabled = true; } }
public void ShieldHit(DamageEffect damage) { audiosource.PlayOneShot(shieldHitSound); Strength = Strength - damage.shieldBlocked; }
// Use this for initialization void Start() { Instance = this; }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { // 말풍선. this.balloon = this.gameObject.AddComponent<chrBalloon>(); // 대미지를 먹었을 때 효과(임시). this.damage_effect = new DamageEffect(this.gameObject); // 애니메이션 컴포넌트를 찾아둔다. this.anim_player = this.transform.GetComponentInChildren<Animation>(); if (this.anim_player != null) { this.anim_player.cullingType = AnimationCullingType.AlwaysAnimate; } this.current_motion.name = ""; this.current_motion.layer = -1; this._start(); this.behavior.start(); this.previous_position = this.transform.position; }
public void dealDamage(DamageEffect damage, GameObject cause = null) { EntityView.SetHealth(EntityView.GetHealth() - damage.damageTaken); EntityView.SetShields(EntityView.GetShields() - damage.shieldBlocked); if(damage.damageTaken > 0) { GameObject go = Instantiate(damageCounterPrefab); go.transform.position = new Vector3(transform.position.x, transform.position.y + 15, transform.position.z); DamageCounter counter = go.GetComponent<DamageCounter>(); counter.Damage = damage.damageTaken; } if(shields != null && damage.shieldBlocked > 0) { shields.ShieldHit(damage); } }
public DamageType(DamageEffect effect, int damage, int altDamage) { Effect = effect; Damage = damage; AltDamage = altDamage; }