Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » DirectX » Games » Downloads
 
Add your own
alternative version

Game Engine

, 20 Nov 2009 CPL
A game engine first prototype
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MTV3D65;


namespace gefx
{
   public  class Particles
    {
       TVParticleSystem ParticlesSys;
       public  List<TVParticleSystem> Particle = new List<TVParticleSystem>();

       public Particles()
       {
           ParticlesSys = new TVParticleSystem();

       }

       public void AddParticles(ref TVScene Scene, string PathToFile, string Name)
       {
           ParticlesSys = Scene.CreateParticleSystem(Name);

           ParticlesSys.Load(PathToFile);
           ParticlesSys.SetName(Name);

           

           Particle.Add(ParticlesSys);
       }

       public void DrawParticles(string Name)
       {
           if (Name == "All")
           {

               foreach (TVParticleSystem s in Particle)
               {

                   s.Render();

               }
           }
           else
           {
               foreach (TVParticleSystem s in Particle)
               {
                   if (s.GetName() == Name)
                   {
                       s.Render();
                       break;
                   }
               } 

           }

       }

       public void UpdateParticles(string Name)
       {

           if (Name == "All")
           {

               foreach (TVParticleSystem s in Particle)
               {

                   s.Update();

               }
           }
           else
           {
               foreach (TVParticleSystem s in Particle)
               {
                   if (s.GetName() == Name)
                   {
                       s.Update();
                       break;
                   }
               }

           }
       }

       public TV_3DVECTOR GetEmmiterPosition(string Name,int emmiter)
       {
           TV_3DVECTOR r = new TV_3DVECTOR(0, 0, 0);

           foreach (TVParticleSystem part in Particle)
           {
               if (part.GetName() == Name)
               {

                   r = part.GetEmitterPosition(emmiter);
                   break;
               }

           }
           return r;
       }


       public void SetEmmiterPosition(string Name,TV_3DVECTOR P,int emmiter)
       {
           foreach (TVParticleSystem part in Particle)
           {
               if (part.GetName() == Name)
               {

                   part.SetEmitterPosition(emmiter, P);
                   break;
               }

           }

       }

       public void MoveEmitter(string Name, TV_3DVECTOR P, int emmiter)
       {
           foreach (TVParticleSystem part in Particle)
           {
               if (part.GetName() == Name)
               {
                   part.MoveEmitter(emmiter, P);
                   break;
               }

           }

       }

       public TV_3DVECTOR GetEmmiterDirection(string Name, int emmiter)
       {

           TV_3DVECTOR r = new TV_3DVECTOR(0, 0, 0);

           foreach (TVParticleSystem part in Particle)
           {
               if (part.GetName() == Name)
               {

                   r = part.GetEmitterDirection(emmiter);
                   break;
               }

           }
           return r;
       }

       public void SetEmmiterDirection(string Name, TV_3DVECTOR s,int emitter)
       {
           foreach (TVParticleSystem part in Particle)
           {
               if (part.GetName() == Name)
               {

                   part.SetEmitterDirection(emitter, true, s, new TV_3DVECTOR(0, 0, 0));
                   break;
               }

           }

       }

       public void AttachToActor(string Name,int IDActor,int Emitter)
       {
           foreach (TVParticleSystem p in Particle)
           {
               if (p.GetName() == Name)
               {
                   p.AttachTo(Emitter, CONST_TV_NODETYPE.TV_NODETYPE_ACTOR, IDActor, 1);

               }

           }

       }

       public void Loop(string Name, int emitter, bool b)
       {
           foreach (TVParticleSystem part in Particle)
           {
               if (part.GetName() == Name)
               {

                   
                   break;
               }

           }

       }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Public License Version 1.0 (CPL)

Share

About the Author

Member 3873633
Software Developer
Croatia Croatia
Programer

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 20 Nov 2009
Article Copyright 2009 by Member 3873633
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid