示例#1
0
        static void Main(string[] args)
        {
            LivingPerson person = new LivingPerson();

            //person.SetAge(33);
            //Console.WriteLine(person.GetAge());

            //person.Age = 330; // Set
            //int whatAge = person.Age; // Get

            person.Age = 18;

            person.SomeMethod(10);
        }
        static void Main(string[] args)
        {
            bool done = false;

            do
            {
                LivingPerson person = new LivingPerson(0);
                Console.Write($"Justera nuvarande ålder {person.Age}: ");
                int age = int.Parse(Console.ReadLine());
                done = age > -1 && age < 121;
                if (done)
                {
                    person.Age = age;
                }
            } while (!done);
        }
示例#3
0
 private int PerformAction(int currentState, object o)
 {
     switch (recognizedSentence)
     {
         case "get the coke from the shelf and bring it to me":
             //ejecutar la sm correspondiente
             GetCoke sm0 = new GetCoke(this.brain, this.cmdMan);
             sm0.Execute();
             break;
         case "grasp the cereal from the kitchen table and detect a person":
             GraspCereal sm1 = new GraspCereal(this.brain, this.cmdMan);
             sm1.Execute();
             break;
         case "take the jam from the side table and deliver it to the shelf":
             //ejecutar la sm correspondiente
             TakeJam sm2 = new TakeJam(this.brain, this.cmdMan);
             sm2.Execute();
             break;
         case "find a person in the livingroom and answer a question":
             //ejecutar la sm correspondiente
             LivingPerson sm3 = new LivingPerson(this.brain, this.cmdMan);
             sm3.Execute();
             break;
         case "find a person in the bedroom and say the name of your team":
             //ejecutar la sm correspondiente
             BedPerson sm4 = new BedPerson(this.brain, this.cmdMan);
             sm4.Execute();
             break;
         case "look for a person in the hall and tell your name":
             //ejecutar la sm correspondiente
             HallPerson sm5 = new HallPerson(this.brain, this.cmdMan);
             sm5.Execute();
             break;
         case "look for a person in the bedroom and answer a question":
             //ejecutar la sm correspondiente
             BedPersonQuestion sm6 = new BedPersonQuestion(this.brain, this.cmdMan);
             sm6.Execute();
             break;
     }
     return (int)States.LeaveArena;
 }