コード例 #1
0
ファイル: organism.cs プロジェクト: Kluuucha/SLSim
        public void split(int x, int y)
        {
            Organism next = new Organism(species, sightDistance, ferocity, maxValue, speed, currValue / 2);

            currValue -= currValue / 2;
            next.posX  = x;
            next.posY  = y;

            next.mutate();
            this.mutate();

            Simulation.simulationGrid.Add(next.key(), next);
        }
コード例 #2
0
ファイル: organism.cs プロジェクト: Kluuucha/SLSim
        public static Organism newRandomOrganism(Species spec)
        {
            Organism temp = new Organism(spec, spec.seeRange, spec.power, spec.maxValue, spec.speed, spec.maxValue / 2);
            int      key  = 0;

            do
            {
                temp.posX = Simulation.random.Next(Settings.xResolution - 1);
                temp.posY = Simulation.random.Next(Settings.yResolution - 1);
                key       = temp.key();
            }while (Simulation.simulationGrid.ContainsKey(key));
            Simulation.simulationGrid.Add(key, temp);
            return(temp);
        }