Beispiel #1
0
        public override void initActors()
        {
            actors = new LinkedList <Actor>();

            // Ensure that player is the first actor loaded
            int playerIndex = file.worldObjects.FindIndex((a) => (a.id == 0));

            if (playerIndex != 0 && playerIndex != -1)
            {
                MapFile.WorldObjectData player = file.worldObjects[playerIndex];
                file.worldObjects.RemoveAt(playerIndex);
                file.worldObjects.Insert(0, player);
            }

            base.initActors();
        }
        public override void doLeftDownAction()
        {
            Tile victim = getMouseWorldPos();

            if (victim != null)
            {
                Actor p = editor.world.actorFactory.createActor((editor.world as EditorWorld).currentActor, new Vector2(victim.x, victim.y), null);
                MapFile.WorldObjectData w = new MapFile.WorldObjectData();
                w.id = (byte)(editor.world as EditorWorld).currentActor;
                w.x  = (ushort)victim.xIndex;
                w.y  = (ushort)victim.yIndex;
                editor.world.file.worldObjects.Add(w);

                undos.Clear();

                toolAction.Push(new ActorToolAction(w, this));
            }

            editor.world.actors.Clear();
            editor.world.initActors();
        }
 public EraserToolAction(MapFile.WorldObjectData actor, Tool parent) : base(parent)
 {
     this.actor = actor;
 }
 public override void redoAction(ToolAction action)
 {
     MapFile.WorldObjectData w = (action as EraserToolAction).actor;
     editor.world.file.worldObjects.Remove(w);
     editor.world.initActors();
 }