Ejemplo n.º 1
0
        public Danmaku SpawnDanmaku(DanmakuPrefab prefab,
                                    Vector2 location,
                                    float rotation)
        {
            if (prefab == null)
            {
                throw new ArgumentNullException("prefab");
            }
            Danmaku danmaku = prefab.Get();

            danmaku.Position = position;
            danmaku.Rotation = rotation;
            return(danmaku);
        }
Ejemplo n.º 2
0
        public Danmaku FireLinear(DanmakuPrefab prefab,
                                  Vector2 location,
                                  float rotation,
                                  float speed)
        {
            if (prefab == null)
            {
                throw new ArgumentNullException("prefab");
            }
            Danmaku danmaku = prefab.Get();

            danmaku.Position     = position;
            danmaku.Rotation     = rotation;
            danmaku.Speed        = speed;
            danmaku.AngularSpeed = 0f;
            return(danmaku);
        }
Ejemplo n.º 3
0
        // MUST be called from a DanmakuPrefab
        internal void Init(Renderer renderer, DanmakuPrefab prefab)
        {
            if (!prefab)
            {
                throw new ArgumentNullException("prefab");
            }

            this.prefab = prefab;

            size         = prefab.cachedScale.Max();
            _totalCount  = 0;
            _activeCount = 0;
            _spawnCount  = prefab.spawnCount;
            if (_spawnCount <= 0)
            {
                _spawnCount = 1;
            }
            all = new Danmaku[prefab.initialCount * 2];
            Spawn(prefab.initialCount);

            material     = renderer.sharedMaterial;
            sortingLayer = renderer.sortingLayerID;
            sortingOrder = renderer.sortingOrder;
            mesh         = new Mesh();

            OnInit(renderer);

            Matrix4x4 rot = Matrix4x4.TRS(Vector3.zero,
                                          Quaternion.Euler(0f, 0f, prefab.rotationOffset),
                                          prefab.transform.localScale);

            Vector3[] verts = mesh.vertices;
            for (int i = 0; i < verts.Length; i++)
            {
                verts[i] = rot * verts[i];
            }
            mesh.vertices = verts;

            dRenderer.mesh = mesh;

            danmakuSystem.startColor = color;
            dRenderer.sharedMaterial = material;
            dRenderer.sortingLayerID = sortingLayer;
            dRenderer.sortingOrder   = sortingOrder;
        }
Ejemplo n.º 4
0
 public FireData Copy(FireData other)
 {
     if (other == null || other == this)
     {
         return(this);
     }
     AngularSpeed = other.AngularSpeed;
     Controller   = other.Controller;
     OnActivate   = other.OnActivate;
     OnDestroy    = other.OnDestroy;
     Damage       = other.Damage;
     Position     = other.Position;
     Prefab       = other.Prefab;
     Rotation     = other.Rotation;
     Speed        = other.Speed;
     Color        = other.Color;
     return(this);
 }
 public static IEnumerable <Danmaku> Match(this IEnumerable <Danmaku> danmakus, DanmakuPrefab prefab, Func <Danmaku, bool> filter = null)
 {
     return(danmakus.ForEach(x => prefab.Match(x), filter));
 }