示例#1
0
 void listen(Services.Post post)
 {
     if (post.category == Services.PostCategory.END_GAME)
     {
         sticky_ = false;
     }
 }
示例#2
0
 public void onPost(Services.Post post)
 {
     state.onPost(post);
     if (post.category == PostCategory.END_GAME)
     {
         //if (windows.Contains(systems))
         //windows.Remove(systems);
     }
 }
示例#3
0
        public virtual void onPost(Services.Post post)
        {
            switch (post.category)
            {
            case PostCategory.PLACING_OBJECT:
                changeState(new ControlStates.Placer(post.targetEntity));
                break;

            default:
                break;
            }
        }
示例#4
0
        public override void onPost(Services.Post post)
        {
            switch (post.category)
            {
            case PostCategory.INV_SLOT:
                if (post.component != null)
                {
                    InventoryComponent inv  = (InventoryComponent)post.component;
                    GameEntity         slot = inv.getItem(post.slot);
                    if (slot == null)
                    {
                        inv.placeItem(item_, post.slot);
                        changeState(new Selector());
                    }
                    else if (slot.item.ID_ == item_.item.ID_)
                    {
                        if (item_.item.number_ > 1 && Locator.getInputHandler().isKeyDown(Keys.LeftShift))
                        {
                            slot.item.number_++;
                            item_.item.number_--;
                            itemButton_.refresh(item_);
                            inv.onUpdate();
                        }
                        else
                        {
                            slot.item.number_ += item_.item.number_;
                            item_              = null;
                            inv.onUpdate();
                            changeState(new Selector());
                        }
                    }
                    else
                    {
                        inv.takeItem(post.slot);
                        inv.placeItem(item_, post.slot);
                        changeState(new HoldingItem(inv, post.targetEntity, post.slot));
                    }
                }
                return;

            default:
                break;
            }
            base.onPost(post);
        }
示例#5
0
        public void onPost(Services.Post post)
        {
            switch (post.category)
            {
            case Services.PostCategory.END_GAME:
                thrustText.text_  = "7.9 MN";
                thrustbar.percent = 7.9f / 39.4f;
                break;

            case Services.PostCategory.REPAIRED_ENGINE:
                engineText.text_    = "1 / 5";
                thrustMaxText.text_ = "39.4 MN";
                break;

            default:
                break;
            }
        }
示例#6
0
        public void notify(Services.Post post)
        {
            if (post.category == Services.PostCategory.JUNK_SHOT)
            {
                if (post.targetEntity == entity_)
                {
                    float speed = entity_.physic.velocity_.Length() / 6f;
                    for (int i = 0; i < 3; ++i)
                    {
                        GameEntity e = Locator.getObjectFactory().createDebris();
                        e.spatial.w_translation = entity_.spatial.w_translation;
                        float angle = 2f * ((float)Locator.getRandom().NextDouble() - 0.5f) * MathHelper.PiOver4;

                        //hardcoded to go up
                        e.physic.velocity_ = new Vector2((float)Math.Sin(angle) * speed, -(float)Math.Cos(angle) * speed);
                        Locator.getComponentManager().addEntity(e);
                    }
                    Locator.getComponentManager().removeEntity(entity_);
                }
            }
        }