public static T Damage <T> (this T danmakus, DynamicInt damage) where T : class, IEnumerable <Danmaku>
        {
            if (danmakus == null)
            {
                return(null);
            }
            var arrayTest = danmakus as Danmaku[];

            if (arrayTest != null)
            {
                for (int i = 0; i < arrayTest.Length; i++)
                {
                    Danmaku danmaku = arrayTest[i];
                    if (danmaku != null)
                    {
                        danmaku.Damage = damage.Value;
                    }
                }
            }
            else
            {
                foreach (var danmaku in danmakus)
                {
                    if (danmaku != null)
                    {
                        danmaku.Damage = damage.Value;
                    }
                }
            }
            return(danmakus);
        }
 public static Danmaku[] GetInactive(FireData data, DynamicInt count)
 {
     if (danmakuPool == null)
     {
         new GameObject("Danmaku Game Controller").AddComponent <DanmakuGameController>();
     }
     if (data == null)
     {
         throw new System.ArgumentNullException();
     }
     Danmaku[] danmakus = new Danmaku[count];
     danmakuPool.Get(danmakus);
     for (int i = 0; i < danmakus.Length; i++)
     {
         Danmaku danmaku = danmakus[i];
         danmaku.MatchPrefab(data.Prefab);
         danmaku.position.x   = data.Position.x;
         danmaku.position.y   = data.Position.y;
         danmaku.Rotation     = data.Rotation.Value;
         danmaku.Speed        = data.Speed.Value;
         danmaku.AngularSpeed = data.AngularSpeed.Value;
         danmaku.AddController(data.Controller);
         danmaku.Damage = data.Damage.Value;
     }
     return(danmakus);
 }
示例#3
0
 public override bool Equals(object obj)
 {
     if (obj is DynamicInt)
     {
         DynamicInt df = (DynamicInt)obj;
         return(df == this);
     }
     return(false);
 }
 public static Danmaku[] GetInactive(DynamicInt count)
 {
     if (danmakuPool == null)
     {
         new GameObject("Danmaku Game Controller").AddComponent <DanmakuGameController>();
     }
     Danmaku[] array = new Danmaku[count];
     danmakuPool.Get(array);
     return(array);
 }
 public void Copy(FireData other)
 {
     Prefab       = other.Prefab;
     Field        = other.Field;
     Position     = other.Position;
     Rotation     = other.Rotation;
     Speed        = other.Speed;
     AngularSpeed = other.AngularSpeed;
     Controller   = other.Controller;
     Damage       = other.Damage;
     Group        = other.Group;
 }
 public static Danmaku[] GetInactive(Vector2 position, DynamicFloat rotation, DynamicInt count)
 {
     if (danmakuPool == null)
     {
         new GameObject("Danmaku Game Controller").AddComponent <DanmakuGameController>();
     }
     Danmaku[] array = new Danmaku[count];
     GetInactive(position, rotation, array);
     danmakuPool.Get(array);
     for (int i = 0; i < array.Length; i++)
     {
         Danmaku danmaku = array[i];
         danmaku.position.x = position.x;
         danmaku.position.y = position.y;
         danmaku.Rotation   = rotation.Value;
     }
     return(array);
 }
 public FireBuilder WithDamage(int min, int max)
 {
     Damage = new DynamicInt(min, max);
     return(this);
 }
 public FireBuilder WithDamage(DynamicInt damage)
 {
     Damage = damage;
     return(this);
 }