예제 #1
0
        public Particle(ImageTexture texture, float x, float y, float _rotation, float speed, int lifetime, float sizex, float sizey, byte[] color, int parent, bool physics, bool mass) : base()
        {
            Type = "Particle.Particle";
            SetSize(sizex, sizey);
            SetTexture(texture);
            _lifeTime = lifetime;
            SetRotation(_rotation);
            SetPos(x, y);
            _speed = speed;
            EnablePhysics(physics);
            SetStaticObject(false);
            EnableAirResistance(false);
            SetIsParticle(true);
            HasMass(mass);
            float xAdd = (float)Math.Sin((double)GetRotation());
            float yAdd = (float)Math.Cos((double)GetRotation());

            SetVelocity(xAdd * _speed, yAdd * _speed);
            SetPhysSize(0.1f);
            SetColor(color);
            _parent = parent;
            if (parent != 0)
            {
                Z_Index = TomatoMainEngine.GetRenderObject(_parent).Z_Index - 1;
            }
            else
            {
                Z_Index = 999999999;
            }
        }
예제 #2
0
 public override void Update(GameSettings settings)
 {
     base.Update(settings);
     if (_parentId != 0)
     {
         GameObject parent = TomatoMainEngine.GetRenderObject(_parentId);
         SetPos(parent.GetPosition());
         SetRotation(parent.GetRotation());
         _vertexPos.X    = GetPosition().x;
         _vertexPos.Y    = GetPosition().y;
         _vertexPos.Z    = 1;
         _light.Position = _vertexPos;
     }
 }