Example #1
0
        public void Run()
        {
            ConsoleRead  consoleRead  = new ConsoleRead();
            ConsoleWrite consoleWrite = new ConsoleWrite();
            CreateBlobs  createBlob   = new CreateBlobs();
            Attacking    attacking    = new Attacking();
            Data         data         = new Data();

            string input = "";

            while (input != "drop")
            {
                input = consoleRead.Read();

                string[] commant = input.Split();

                if (commant[0] == "create")
                {
                    string name     = commant[1];
                    int    health   = Int32.Parse(commant[2]);
                    int    damage   = Int32.Parse(commant[3]);
                    string behavior = commant[4];
                    string attack   = commant[5];

                    data.AddBlob(createBlob.Create(name, health, damage, behavior, attack));
                }
                else if (commant[0] == "attack")
                {
                    attacking.Attack(data.Blobs, commant[1], commant[2]);
                }
                else if (commant[0] == "status")
                {
                    consoleWrite.WriteList(data.Blobs);
                }
                else if (commant[0] == "pass")
                {
                }
                else if (commant[0] == "drop")
                {
                    Environment.Exit(0);
                }
            }
        }
Example #2
0
        public void Run()
        {
            string input = null;

            while (input != "drop")
            {
                input = consoleRead.Read();

                string[] command = input.Split();

                switch (command[0])
                {
                case "create":
                    string name     = command[1];
                    int    health   = Int32.Parse(command[2]);
                    int    damage   = Int32.Parse(command[3]);
                    string behavior = command[4];
                    string attack   = command[5];

                    blob = blobCreator.Create(name, health, damage, behavior, attack);
                    data.AddBlob(blob);
                    break;

                case "attack":
                    string attacker = command[1];
                    string defender = command[2];
                    data.Blobs = attackBlob.Attack(data.Blobs, attacker, defender);
                    break;

                case "status":
                    consoleWrite.WriteList(data.Blobs);
                    break;

                case "pass":
                    break;

                default:
                    break;
                }
            }
        }