Ejemplo n.º 1
0
        public override List <Point3d> findNeighborParticle(Amoeba agent, int radius)
        {
            List <Point3d> nei = new List <Point3d>();
            int            x   = agent.curx;
            int            y   = agent.cury;
            //int z = agent.curz;
            int start_x = x - radius > 0 ? x - radius : 0;
            int start_y = y - radius > 0 ? y - radius : 0;
            //int start_z = z - radius > 0 ? z - radius : 0;
            int end_x = x + radius <= u - 1 ? x + radius : u - 1;
            int end_y = y + radius <= v - 1 ? y + radius : v - 1;

            //int end_z = z + radius <= w - 1 ? z + radius : w - 1;
            for (int i = start_x; i <= end_x; i++)
            {
                for (int j = start_y; j <= end_y; j++)
                {
                    //for (int k = start_z; k <= end_z; k++)
                    //{
                    if (isOccupidByParticleByIndex(i, j, 0) == true)
                    {
                        //nei.Add(new Point3d(i, j, k));
                        nei.Add(uv_positions[i, j, 0]);
                    }
                    //}
                }
            }

            return(nei);
        }
Ejemplo n.º 2
0
        public TestAmoeba()
        {
            double tol = 0.001;

            am = new Amoeba();
            am.ToleranceRequested = tol;
            am.Function           = TestFunctions.parabola;
        }
Ejemplo n.º 3
0
        public static void ExecuteExample()
        {
            // Create the dynamic type and attribute a value
            dynamic variable1 = 1;

            Console.WriteLine(variable1.GetType().ToString()); //System.Int32

            // In this case the method will receive a dynamic type
            var dog1    = new Dog();
            var person1 = new Person();

            MakeItTalk(dog1);
            MakeItTalk(person1);

            // As you can see, it can be dangerous. You can just pass an invalid object,
            // that will not be infered/verified at compile-time, generating an exception at runtime
            var amoeba = new Amoeba();

            MakeItTalk(amoeba); // Return a RuntimeBinderException, when calling Talk() method
        }
Ejemplo n.º 4
0
    void OnTriggerEnter(Collider other)
    {
        Amoeba amoeba = other.gameObject.GetComponent <Amoeba>();

        if (amoeba == null)
        {
            return;
        }
        if (amoeba.type == AmoebaType.Agility)
        {
            agility++;
        }
        else if (amoeba.type == AmoebaType.Essence)
        {
            essence++;
        }
        else if (amoeba.type == AmoebaType.Fury)
        {
            health = Mathf.Min(health + 1, maxHealth + 1);
            fury++;
        }
        GameObject.Destroy(other.gameObject);
    }
Ejemplo n.º 5
0
        static void Main(string[] args, object hewan)
        {
            Console.WriteLine("\n\t Menggunakan abstraction class\n");
            Hewan hewan = new Kucing();

            new Kucing.Berkembangbiak();
            hewan = new Ikan();
            new Ikan.Berkembangbiak();
            hewan = new Amoeba();
            new Amoeba.Berkembangbiak();

            IHewan ihewan;

            Console.WriteLine("\n\t Menggunakan Interface\n");
            ihewan = new Kucing();
            ihewan.Berkembangbiak();
            ihewan = new Ikan();
            ihewan.Berkembangbiak();
            ihewan = new Amoeba();
            ihewan.Berkembangbiak();
            ihewan.Lain();

            Console.ReadKey();
        }
Ejemplo n.º 6
0
        public override List<Point3d> findNeighborParticle(Amoeba agent, int radius)
        {
            List<Point3d> nei = new List<Point3d>();
            int x = agent.curx;
            int y = agent.cury;
            //int z = agent.curz;
            int start_x = x - radius > 0 ? x - radius : 0;
            int start_y = y - radius > 0 ? y - radius : 0;
            //int start_z = z - radius > 0 ? z - radius : 0;
            int end_x = x + radius <= u - 1 ? x + radius : u - 1;
            int end_y = y + radius <= v - 1 ? y + radius : v - 1;
            //int end_z = z + radius <= w - 1 ? z + radius : w - 1;
            for (int i = start_x; i <= end_x; i++)
            {
                for (int j = start_y; j <= end_y; j++)
                {
                    //for (int k = start_z; k <= end_z; k++)
                    //{
                        if (isOccupidByParticleByIndex(i, j, 0) == true)
                        {
                            //nei.Add(new Point3d(i, j, k));
                            nei.Add(uv_positions[i, j, 0]);
                        }
                    //}
                }
            }

            return nei;
        }
Ejemplo n.º 7
0
 public abstract int countNumberOfParticlesPresentByIndex(int u, int v, int w, int radius);   //by index
 public abstract List <Point3d> findNeighborParticle(Amoeba agent, int radius);
        public static void EzraDoubleActionsCampaignMission2()
        {
            var players = new List <Player>
            {
                CreateBluePlayerDoubleActionsCampaignMission2(),
                CreateGreenPlayerDoubleActionsCampaignMission2(),
                CreateYellowPlayerDoubleActionsCampaignMission2(),
                CreateRedPlayerDoubleActionsCampaignMission2()
            };

            var externalTracksByZone = new Dictionary <ZoneLocation, TrackConfiguration>
            {
                { ZoneLocation.Blue, TrackConfiguration.Track7 },
                { ZoneLocation.White, TrackConfiguration.Track2 },
                { ZoneLocation.Red, TrackConfiguration.Track5 }
            };
            const TrackConfiguration internalTrack = TrackConfiguration.Track4;

            var interstellarOctopus = new InterstellarOctopus();

            interstellarOctopus.SetInitialPlacement(3, ZoneLocation.Blue);
            var meteoroid = new Meteoroid();

            meteoroid.SetInitialPlacement(8, ZoneLocation.Blue);
            var amoeba = new Amoeba();

            amoeba.SetInitialPlacement(2, ZoneLocation.White);
            var stealthFighter = new StealthFighter();

            stealthFighter.SetInitialPlacement(4, ZoneLocation.White);
            var spinningSaucer = new SpinningSaucer();

            spinningSaucer.SetInitialPlacement(7, ZoneLocation.White);
            var armoredGrappler = new ArmoredGrappler();

            armoredGrappler.SetInitialPlacement(1, ZoneLocation.Red);
            var externalThreats = new ExternalThreat[] { interstellarOctopus, meteoroid, amoeba, stealthFighter, spinningSaucer, armoredGrappler };

            var commandosB = new CommandosB();

            commandosB.SetInitialPlacement(5);
            var hackedShieldsB = new HackedShieldsB();

            hackedShieldsB.SetInitialPlacement(8);
            var internalThreats = new InternalThreat[] { commandosB, hackedShieldsB };

            var bonusThreats = new Threat[0];

            var game = new Game(players, internalThreats, externalThreats, bonusThreats, externalTracksByZone, internalTrack, null);

            game.StartGame();
            for (var currentTurn = 0; currentTurn < game.NumberOfTurns + 1; currentTurn++)
            {
                game.PerformTurn();
            }
            Assert.AreEqual(GameStatus.Won, game.GameStatus);
            Assert.AreEqual(2, game.SittingDuck.BlueZone.TotalDamage);
            Assert.AreEqual(0, game.SittingDuck.RedZone.TotalDamage);
            Assert.AreEqual(5, game.SittingDuck.WhiteZone.TotalDamage);
            Assert.AreEqual(6, game.ThreatController.DefeatedThreats.Count());
            Assert.AreEqual(2, game.ThreatController.SurvivedThreats.Count());
            Assert.AreEqual(0, players.Count(player => player.IsKnockedOut));
            Assert.AreEqual(2, game.SittingDuck.BlueZone.CurrentDamageTokens.Count);
            Assert.AreEqual(0, game.SittingDuck.RedZone.CurrentDamageTokens.Count);
            Assert.AreEqual(5, game.SittingDuck.WhiteZone.CurrentDamageTokens.Count);
        }