Example #1
0
 protected virtual void DamageShield(int dmg)
 {
     if (additionalShield > 0)
     {
         additionalShield -= dmg;
         if (additionalShield <= 0)
         {
             additionalShield = 0;
             if (typeof(IReturnable).IsAssignableFrom(typeof(Soul)))
             {
                 IReturnable r = (IReturnable)empoweringObject;
                 r.ReturnObject();
             }
         }
     }
     else if (currentShiledPoints > 0)
     {
         currentShiledPoints -= dmg;
         if (currentShiledPoints < 0)
         {
             currentShiledPoints = 0;
         }
     }
     else
     {
         DamageHP(dmg);
     }
 }
Example #2
0
 public CruiserBulletManager(IEnemy enemy, Transform bullet, IShip ship, float bulletSpeed)
 {
     _bulletSpeed   = bulletSpeed;
     _enemy         = enemy;
     _upTimer       = new UpTimer(0.0f, 0.5f);
     _returnChecker = new TransformCollisionAndReturnChecker(ship);
     _bulletPull    = new BulletPull(bullet);
     _bullets       = new List <Transform>();
 }
Example #3
0
 public BulletManager(Transform bullet, Transform barrel, float bulletSpeed, ShipWeaponLocker weaponLocker)
 {
     _barrel        = barrel;
     _bulletSpeed   = bulletSpeed;
     _fire          = new PCUserInputFire();
     _bulletPull    = new BulletPull(bullet);
     _returnChecker = new TransformReturnChecker();
     _bullets       = new List <Transform>();
     _weaponLocker  = weaponLocker;
 }
 public ReturnTypesDoNotMatchException(IReturnable returnable, IType expected, IType actual)
     : base(
         $"{returnable.ParentType.Name}.{returnable.Name}: Expected return type is {expected}, but given return type is {actual}")
 {
 }
 public static bool ReturnTypeHas(this IReturnable source, TypeInfo attributeType) =>
 source.GetReturnTypeCustomAttributes().Any(a => a.GetTypeInfo() == attributeType);
 public static bool ReturnTypeHas <TAttribute>(this IReturnable source) where TAttribute : Attribute => source.ReturnTypeHas(type.of <TAttribute>());
 public static bool ReturnsCollection(this IReturnable source, IType itemType, string name) =>
 source.ReturnsCollection(itemType) && source.Name == name;
 public static bool ReturnsCollection <T>(this IReturnable source, string name) => source.ReturnsCollection(type.of <T>(), name);
 public static bool ReturnsCollection(this IReturnable source, string name) => source.ReturnsCollection <object>(name);
 public static bool ReturnsCollection(this IReturnable source, IType itemType) =>
 source.ReturnType.CanBeCollection(itemType);
 public static bool ReturnsCollection <T>(this IReturnable source) => source.ReturnsCollection(type.of <T>());
 public static bool ReturnsCollection(this IReturnable source) => source.ReturnsCollection <object>();
 public static bool Returns(this IReturnable source, IType returnType, string name) =>
 source.Returns(returnType) && source.Name == name;
 public static bool Returns(this IReturnable source, IType returnType) =>
 source.ReturnType.CanBe(returnType);
 public static bool Returns <T>(this IReturnable source) => source.Returns(type.of <T>());
 public virtual void AddToList(IReturnable newReturnable)
 {
     Returnables.Cast <IReturnable>().ToList().Add(newReturnable);
 }