コード例 #1
0
 public void Update(TimeSpan delta, Matrix4 transform, float sparam)
 {
     if (Pool == null)
     {
         return;
     }
     lasttime    = globaltime;
     globaltime += delta.TotalSeconds;
     //Line buffers
     foreach (var buf in BeamAppearances.Values)
     {
         for (int i = 0; i < buf.Count(); i++)
         {
             if (buf[i].ParticleIndex >= 0 && (!Pool.Particles[buf[i].ParticleIndex].Active || Pool.Particles[buf[i].ParticleIndex].Instance != this))
             {
                 buf[i] = new LinePointer()
                 {
                     Active = false, ParticleIndex = -1
                 }
             }
             ;
         }
     }
     //Update Emitters
     for (int i = 0; i < Effect.References.Count; i++)
     {
         var r = Effect.References[i];
         if (NodeEnabled(r) && (r.Node is FxEmitter))
         {
             ((FxEmitter)r.Node).Update(r, this, delta, ref transform, sparam);
         }
     }
 }
コード例 #2
0
    public static void SetLinePointerDirect(Vector3 direct)
    {
        if (!SkillPointerManager._linePointer.IsValid <LinePointer>())
        {
            return;
        }
        LinePointer component = SkillPointerManager._linePointer.Component;

        if (!component.isShow)
        {
            return;
        }
        component.SetDirect(direct);
    }
コード例 #3
0
 public void Update(TimeSpan delta, Matrix4 transform, float sparam)
 {
     globaltime   += delta.TotalSeconds;
     freeParticles = true;
     for (int i = 0; i < Particles.Length; i++)
     {
         if (!Particles[i].Active)
         {
             continue;
         }
         Particles[i].Position  += Particles[i].Normal * (float)delta.TotalSeconds;
         Particles[i].TimeAlive += (float)delta.TotalSeconds;
         if (Particles[i].TimeAlive >= Particles[i].LifeSpan)
         {
             Particles[i].Active = false;
             emitStates[Particles[i].Emitter].ParticleCount--;
             continue;
         }
     }
     //Clean the circular buffers
     foreach (var buffer in BeamAppearances.Values)
     {
         for (int i = 0; i < buffer.Count; i++)
         {
             if (buffer[i].Active && Particles[buffer[i].ParticleIndex].Active == false)
             {
                 buffer[i] = new LinePointer()
                 {
                     ParticleIndex = -256, Active = false
                 }
             }
             ;
         }
         while (buffer.Count > 0 && buffer.Peek().Active == false)
         {
             buffer.Dequeue();
         }
     }
     //Update Emitters
     for (int i = 0; i < Effect.References.Count; i++)
     {
         var r = Effect.References[i];
         if (NodeEnabled(r) && (r.Node is FxEmitter))
         {
             ((FxEmitter)r.Node).Update(r, this, delta, ref transform, sparam);
         }
     }
 }
コード例 #4
0
 public void Update(TimeSpan delta, Matrix4 transform, float sparam)
 {
     lasttime      = globaltime;
     globaltime   += delta.TotalSeconds;
     freeParticles = true;
     for (int i = 0; i < Particles.Length; i++)
     {
         if (!Particles[i].Active)
         {
             continue;
         }
         Particles[i].Position  += Particles[i].Normal * (float)delta.TotalSeconds;
         Particles[i].TimeAlive += (float)delta.TotalSeconds;
         if (Particles[i].TimeAlive >= Particles[i].LifeSpan)
         {
             Particles[i].Active = false;
             emitStates[Particles[i].Emitter].ParticleCount--;
             continue;
         }
     }
     //Line buffers
     foreach (var buf in BeamAppearances.Values)
     {
         for (int i = 0; i < buf.Count(); i++)
         {
             if (buf[i].ParticleIndex >= 0 && !Particles[buf[i].ParticleIndex].Active)
             {
                 buf[i] = new LinePointer()
                 {
                     Active = false, ParticleIndex = -1
                 }
             }
             ;
         }
     }
     //Update Emitters
     for (int i = 0; i < Effect.References.Count; i++)
     {
         var r = Effect.References[i];
         if (NodeEnabled(r) && (r.Node is FxEmitter))
         {
             ((FxEmitter)r.Node).Update(r, this, delta, ref transform, sparam);
         }
     }
 }
コード例 #5
0
    public static void ShowLinePointer(Units self, Vector3 direct, float width = 0f, float length = 0f)
    {
        if (SkillPointerManager._linePointer == null)
        {
            SkillPointerManager._linePointer = SkillPointerManager.CreateLinePointer(self);
        }
        LinePointer component = SkillPointerManager._linePointer.Component;

        if (!component.isShow)
        {
            component.Show();
        }
        component.followBehavior.isActive = true;
        if (width != 0f && length != 0f)
        {
            component.SetEffectRange(width, length);
        }
        component.SetDirect(direct);
    }
コード例 #6
0
    private static ResourceHandleWrapper <LinePointer> CreateLinePointer(Units self)
    {
        ResourceHandle resourceHandle = MapManager.Instance.SpawnResourceHandle("LinePointer", null, 0);
        Transform      raw            = resourceHandle.Raw;

        raw.gameObject.SetActive(false);
        raw.gameObject.layer = LayerMask.NameToLayer("SkillPointer");
        EffectFollowBehavior effectFollowBehavior = raw.gameObject.GetComponent <EffectFollowBehavior>();

        if (effectFollowBehavior == null)
        {
            effectFollowBehavior = raw.gameObject.AddComponent <EffectFollowBehavior>();
        }
        effectFollowBehavior.SetFollowObj(self.transform, Vector3.up / 5f);
        raw.position      = Vector3.zero;
        raw.localRotation = Quaternion.Euler(Vector3.up);
        LinePointer component = raw.GetComponent <LinePointer>();

        component.theurgist      = self;
        component.followBehavior = effectFollowBehavior;
        return(new ResourceHandleWrapper <LinePointer>(resourceHandle));
    }
コード例 #7
0
        public void GetReferenceEntityAsLine()
        {
            var buffer = new LineBuffer()
            {
                Handle     = "2f8",
                LayerName  = "TestLayer",
                EntityType = typeof(Line),
                Thickness  = 0.0,
                X0         = 0.0,
                X1         = 3.0,
                Y0         = 0.0,
                Y1         = 4.0
            };
            var line = new Line(buffer);

            var testPointer = new LinePointer(line.Handle)
            {
                RefEntity = line
            };

            Assert.IsTrue(testPointer.EntityType == typeof(Line));
            Assert.IsTrue(testPointer.RefEntity == line);
        }