Exemple #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("Trigger: " + collision);
        John player = collision.GetComponent <John>();

        if (player != null)
        {
            //player.Buff(gameObject);
            Debug.Log(gameObject);
            Destroy(gameObject);
        }
    }
Exemple #2
0
        static void Main(string[] args)
        {
            Anna  anna  = new Anna();
            John  john  = new John();
            House house = new House();

            anna.Mandalo();
            john.Question();
            anna.Answear();
            house.Door();
            house.LeavesTheHouse();
            house.CloseTheDoor();
        }
Exemple #3
0
        static void SerializeWorld()
        {
            Agent     John;
            BPNetwork net;
            FoodDrive foodDr;

            if (load && File.Exists(worldLoadFile))
            {
                Console.WriteLine("Deserializing the world");
                SerializationPlugin.DeserializeWorld(worldLoadFile);
                John   = World.GetAgent("John");
                foodDr = (FoodDrive)John.GetInternals(Agent.InternalContainers.DRIVES).First();
                net    = (BPNetwork)foodDr.DriveComponent;
            }
            else
            {
                Console.WriteLine("Initializing the world");
                World.LoggingLevel = TraceLevel.Warning;
                John = World.NewAgent("John");

                foodDr = AgentInitializer.InitializeDrive(John, FoodDrive.Factory, .5);

                net = AgentInitializer.InitializeDriveComponent(foodDr, BPNetwork.Factory);
                net.Input.AddRange(Drive.GenerateTypicalInputs(foodDr));

                net.Parameters.LEARNING_RATE = .2;
                net.Parameters.MOMENTUM      = .05;
                foodDr.Commit(net);
                John.Commit(foodDr);
            }

            DoTraining(net, foodDr);

            Console.WriteLine("Serializing the world");
            SerializationPlugin.SerializeWorld(worldLoadFile);

            John.Die();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            //Human person = new Human("Allisa");
            //Human person2 = new Human();

            // Human is the base class for these 3 classes
            // Tre and Jimmy are derived classes
            // John is a derived class from Jimmy
            // Thus, Jimmy is both a base class and a derived class
            Jimmy jimmy = new Jimmy();
            Tre   tre   = new Tre();
            John  john  = new John();

            // can't do this, because Robot is abstract
            // Robot neth = new Robot();

            Jeff   jeff   = new Jeff("Jeff", 34);
            string answer = jeff.TakeOverTheWorld();

            Console.WriteLine(answer);

            // these four can be in the same array because they
            // are all derived from the Creature class
            Creatures[] myHumans = { jimmy, john, tre, jeff };
            for (int i = 0; i < myHumans.Length; i++)
            {
                if (myHumans[i] is Human)
                {
                    // this outputs only 3 humans
                    // because jeff is a robot
                    Console.WriteLine($"{myHumans[i].Name} is human.");
                }
            }
        }