• Source
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine.UI;
    5. using UnityEditor;
    6. using System;
    7.  
    8. public abstract class Buff{
    9.  
    10. public abstract void Apply(IBuffable<Buff> target);
    11. }
    12. public class PlayerBuff : Buff
    13. {
    14. public Player affectedPlayer { get; private set;}
    15.  
    16. public override void Apply(IBuffable<Buff> target)
    17. {
    18. affectedPlayer = (Player)target;
    19. }
    20. }
    21. public class MagicBallBuff : Buff
    22. {
    23. public MagicBall affectedMagicBall { get; private set; }
    24.  
    25. public override void Apply(IBuffable<Buff> target)
    26. {
    27. affectedMagicBall = (MagicBall)target;
    28. }
    29. }
    30. public class MagicMeteorBuff : Buff
    31. {
    32. public MagicMeteor affectedMagicMeteor { get; private set; }
    33.  
    34. public override void Apply(IBuffable<Buff> target)
    35. {
    36. affectedMagicMeteor = (MagicMeteor)target;
    37. }
    38. }
    39. public class SkillCooldownBuff: Buff
    40. {
    41. public PlayerHUDController affectedHUDController { get; private set; }
    42.  
    43. public override void Apply(IBuffable<Buff> target)
    44. {
    45. affectedHUDController = (PlayerHUDController)target;
    46. }
    47. }
    48. public class PlayerHealthIncreaseBuff: PlayerBuff
    49. {
    50. float playerHealthIncreasePercentage = 20.0f;
    51.  
    52. public override void Apply(IBuffable<Buff> target)
    53. {
    54. float addedBuff = affectedPlayer.playerBaseHeath * (playerHealthIncreasePercentage / 100.0f);
    55. affectedPlayer.playerBonusHealth += (int)addedBuff;
    56.  
    57. base.Apply(target);
    58. }
    59. }
    60. public class MagicBallAttacDamageBuff : MagicBallBuff
    61. {
    62. float magicBallAttackDamageIncreasePercentage = 50.0f;
    63.  
    64. public override void Apply(IBuffable<Buff> target)
    65. {
    66. float addedBuff = affectedMagicBall.magicBallBaseAttackDamage * (magicBallAttackDamageIncreasePercentage / 100.0f);
    67. affectedMagicBall.magicBallExtraAttackDamage += (int)addedBuff;
    68.  
    69. base.Apply(target);
    70. }
    71. }
    72. public class MagicMeteorAttackDamageBuff : MagicMeteorBuff
    73. {
    74. float magicMeteorAttackDamageIncreasePercentage = 25.0f;
    75.  
    76. public override void Apply(IBuffable<Buff> target)
    77. {
    78. float addedBuff = affectedMagicMeteor.magicMeteorBaseAttackDamage * (magicMeteorAttackDamageIncreasePercentage / 100.0f);
    79. affectedMagicMeteor.magicMeteorExtraAttackDamage += (int)addedBuff;
    80.  
    81. base.Apply(target);
    82. }
    83. }
    84. public class SkillCooldownReduce : SkillCooldownBuff
    85. {
    86. float skillCooldownDecreasePercentage = 40.0f;
    87.  
    88. public override void Apply(IBuffable<Buff> target)
    89. {
    90. float addedBuff = affectedHUDController.flashCastBaseCooldownTime * (skillCooldownDecreasePercentage/ 100.0f);
    91. affectedHUDController.magicMeteorCastDecreaseCooldownTime += (int)addedBuff;
    92. affectedHUDController.flashCastDecreaseCooldownTime += (int)addedBuff;
    93.  
    94. base.Apply(target);
    95. }
    96. }