예제 #1
0
 public void TakeDamage(IDamageBehavior damageBehavior, Character source)
 {
     Health.Use(damageBehavior.Damage);
     if (Health.Current <= 0)
     {
         Killed(this, source);
     }
 }
예제 #2
0
        private void Init()
        {
            Acceleration     = 5;
            Angle            = Source.Target != null ? (int)GameWorld.CalcAngle(Source.Location.ToPoint(), Source.Target.Location.ToPoint()) : Source.Angle;
            Cost             = 20;
            Damage           = 200;
            DamageBehavior   = new NormalDamageBehavior(Source, Source.Targets, (int)Damage);
            DrawBehavior     = new TopDownRotationDrawBehavior(this);
            Inertia          = new DecimalPoint(5, 5);
            ActualSpeed      = Source.ActualSpeed;
            Location         = new DecimalPoint(Source.Location.X, Source.Location.Y);
            MotionBehavior   = new NormalMotionBehavior(this, GameWorld);
            Paralax          = Paralax.Middleground;
            TargetSpeed      = 20;
            IsPhysicalObject = false;
            MotionBehavior.CanMoveThroughObjects = true;
            SpellHandler = Source.SpellHandler;
            SpellHandler.Spells.Add(this);
            AttackBehaviors = new List <IAttackBehavior>();

            GameWorld.Collision += GameWorld_Collision;
            GameWorld.Split     += GameWorld_Split;
        }
예제 #3
0
 void Start()
 {
     _damageBehavior = GetComponent<IDamageBehavior>();
 }
예제 #4
0
 void Start()
 {
     _damageBehavior = GetComponent <IDamageBehavior>();
 }
예제 #5
0
 public void TakeDamage(IDamageBehavior damageBehavior, Character source)
 {
     Health.Use(damageBehavior.Damage);
     if (Health.Current <= 0) Killed(this, source);
 }