예제 #1
0
파일: Program.cs 프로젝트: TimyJ/ReaperRL
        static void Main(string[] args)
        {
            WindowUtilities.OpenWindow();
            LayerMasker   mask          = new LayerMasker(3);
            Level         testLevel     = new Level(96, 96, 2, mask.Mask((int)LayerNames.ITEMS));
            LevelRenderer levelRenderer = new LevelRenderer(testLevel);
            Entity        player        = new Entity();
            DisplayInfo   d             = new DisplayInfo(player, '@', Color.White);

            player.AddComponent(d);
            ToolQualities t = new ToolQualities();

            player.AddComponent(t);
            testLevel.EnterLevel(player);
            Entity tree = new Entity();

            tree.AddComponent(new DisplayInfo(tree, '|', Color.ForestGreen));
            tree.AddComponent(new Tree(tree));
            testLevel.Add(tree, (4, 4));
            Globals.AddPanel(levelRenderer);
            MessageLog.AddMessage("Press ? for help");

            while (true)
            {
                Terminal.Clear();
                Globals.DrawAndInput();
                Terminal.Refresh();
            }
        }
예제 #2
0
파일: Tree.cs 프로젝트: TimyJ/ReaperRL
 public bool Interact(Entity e, Level l)
 {
     if (e.HasComponent <ToolQualities>())
     {
         HP -= e.GetComponent <ToolQualities>().WoodCutting;
         if (HP <= 0)
         {
             l.RemoveEntity(Owner);
             MessageLog.AddMessage("You cut down the tree");
             //TODO: spawn items here or add to player inventory.
             return(true);
         }
         MessageLog.AddMessage("You hack at the tree");
     }
     return(false);
 }