public override void Update(float deltaTime)
 {
     if (level.vars.protoEntity != null)
     {
         PositionComponent posComp = ( PositionComponent )level.vars.protoEntity.getComponent(GlobalVars.POSITION_COMPONENT_NAME);
         PointF            p;
         if (level.vars.gridLock)
         {
             p = getGridPoint(level.getInputSystem().mouseX, level.getInputSystem().mouseY);
         }
         else
         {
             p = new PointF(level.getInputSystem().mouseX, level.getInputSystem().mouseY);
         }
         level.getMovementSystem().changePosition(posComp, p.X, p.Y, false, false);
     }
 }
Exemple #2
0
        public override void Update(float deltaTime)
        {
            if (!hasAddedKeys)
            {
                level.getInputSystem().addKey(escKey);
                level.getInputSystem().addKey(delKey);
                level.getInputSystem().addKey(shiftKey);
                hasAddedKeys = true;
            }


            //Check for mouse click. Select/Deselect Entity
            if (level.getInputSystem().mouseLeftClick)
            {
                if (level.vars.protoEntity == null)
                {
                    //Select an entity
                    selectEntityAt(level.getInputSystem().mouseX, level.getInputSystem().mouseY);
                }
                else
                {
                    //Create entity from proto entity
                    createEntityFromProto();
                }
            }

            if (level.getInputSystem().myKeys[escKey].down)
            {
                deselectEntity();
                removeProtoEntity();
            }

            if (level.getInputSystem().myKeys[delKey].down)
            {
                if (level.vars.selectedEntity != null)
                {
                    level.removeEntity(level.vars.selectedEntity);
                    deselectEntity();
                }
            }

            if (level.getInputSystem().myKeys[shiftKey].down)
            {
            }
        }