Ejemplo n.º 1
0
 public void InstanceRemoved(BuildableInstance instance)
 {
     int bx = (int)instance.Position.X/32;
     int by = (int)instance.Position.Y/32;
     _bg.ClearTile(bx, by);
     _walls[bx,by] = false;
     _updateLayout = true;
 }
Ejemplo n.º 2
0
 public void PresentOne(BuildableInstance instance)
 {
     if(_updateLayout)
     {
         int bx = (int)instance.Position.X/32;
         int by = (int)instance.Position.Y/32;
         _walls[bx,by] = true;
     }
 }
Ejemplo n.º 3
0
 public void InstanceAdded(BuildableInstance instance)
 {
     _updateLayout = true;
 }
Ejemplo n.º 4
0
        public void PresentOne(BuildableInstance ti)
        {
            _renderer.Backgrounds[1].SetTile((int)ti.Position.X / 32, (int)ti.Position.Y / 32, 5, 5);

            var weapon = _weaponSprite.Add();

            if((ti.Flags & Sim.BuildableStatePacket.FireFlag) != 0)
            {
                ti.FlashTimer.Reset();
            }

            weapon.X = ti.Position.X;
            weapon.Y = ti.Position.Y;
            weapon.Angle = (ushort)ti.Angle;

            if(ti.FlashTimer.Progress > 0.0f)
            {
                var flash = _flashSprite.Add();
                flash.X = weapon.X;
                flash.Y = weapon.Y;
                flash.Angle = weapon.Angle;

                float amount = (float)Math.Pow(ti.FlashTimer.Progress, 2);
               			flash.Color = new Color4(amount,amount,amount,0.0f);
            }

            ti.FlashTimer.Tick();
        }
Ejemplo n.º 5
0
 public void InstanceRemoved(BuildableInstance ti)
 {
 }
Ejemplo n.º 6
0
 public void InstanceAdded(BuildableInstance ti)
 {
     //	_renderer.Backgrounds[1].SetTile((int)aop.Position.X / 32, (int)ti.Position.Y / 32, 5, 5);
 }
Ejemplo n.º 7
0
        public void OnAddObjectPacket(Sim.ObjectStatePacket added)
        {
            Console.WriteLine("ooa Buildable");
            ISpecificPresenter stp;
            if(!_presenters.TryGetValue(added.TypeId, out stp))
            {
                var u = _config.GetBuildableUpgrade(added.TypeId,0);

                if(added.TypeId == "wall")
                {
                    stp = new WallPresenter(_renderer);
                    _presenters.Add(added.TypeId, stp);
                }
                else
                {
                    SpriteTemplate weaponTemplate, flashTemplate;

                    if(u.SpriteTemplates.TryGetValue("weapon", out weaponTemplate) &&
                       u.SpriteTemplates.TryGetValue("flash",out flashTemplate))
                    {
                        stp = new TowerPresenter(_renderer, weaponTemplate, flashTemplate);
                        _presenters.Add(added.TypeId, stp);
                    }
                }
            }

            var instance = new BuildableInstance(stp);
            stp.InstanceAdded(instance);
            _instances.Add(added.Uid, instance);
        }