private void UnitCollision(IUnit unit) { var enemyModel = unit.GetModel <Assets.Scripts.Game.Units.Enemy.EnemyModel>(); if (enemyModel != null) { var data = new EventArgs(); data.SetValue("Damage", enemyModel.Damage); StateMachine.HandleEvent(PlayerEventType.Damage, data); Damage?.Invoke(enemyModel.Damage); } }
private void UnitCollision(IUnit unit) { var bullet = unit.GetModel <BulletModel>(); if (bullet != null) { var data = new EventArgs(); data.SetValue("Damage", bullet.Damage); StateMachine.HandleEvent(EnemyEventType.Damage, data); } else { var player = unit.GetModel <PlayerModel>(); if (player != null) { StateMachine.SwitchState(EnemyStateType.Death); } } }