Exemple #1
0
 void AddSlimeMoldToList()
 {
     for (int i = 0; i < uiController.newPixels.Count; i++)
     {
         if (uiController.newPixels[i].pixelType == DrawMode.SlimeMold)
         {
             SlimeMold newSlimeMold = new SlimeMold(uiController.newPixels[i].position);
             if (!slimeMoldPixel.Contains(newSlimeMold))
             {
                 slimeMoldPixel.Add(newSlimeMold);
                 food += startFood;
             }
         }
     }
     //for (int i = 0; i < slimeMoldPixel.Count; i++)
     //{
     //    Debug.Log("New pixel at " + slimeMoldPixel[i].position.x + " , " + slimeMoldPixel[i].position.y);
     //}
 }
    public void Realize()
    {
        if (realizedObject != null)
        {
            return;
        }
        switch ((patch_AbstractPhysicalObject.AbstractObjectType)type)
        {
        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.Rock:
            realizedObject = new Rock(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.Spear:
            if (((this as AbstractPhysicalObject) as AbstractSpear).explosive)
            {
                realizedObject = new ExplosiveSpear(this, world);
            }
            else
            {
                realizedObject = new Spear(this, world);
            }
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.FlareBomb:
            realizedObject = new FlareBomb(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.VultureMask:
            realizedObject = new VultureMask(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.PuffBall:
            realizedObject = new PuffBall(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.DangleFruit:
            realizedObject = new DangleFruit(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.PebblesPearl:
            realizedObject = new PebblesPearl(this, world);
            break;

        //case (patch_AbstractPhysicalObject.AbstractObjectType)patch_AbstractPhysicalObject.AbstractObjectType.MoonPearl:
        //    this.realizedObject = new MoonPearl(this, this.world);
        //    break;
        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.SLOracleSwarmer:
            realizedObject = new SLOracleSwarmer(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.SSOracleSwarmer:
            realizedObject = new SSOracleSwarmer(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractObjectType.LMOracleSwarmer:
            realizedObject = new LMOracleSwarmer(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.DataPearl:
            realizedObject = new DataPearl(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.SeedCob:
            realizedObject = new SeedCob(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.WaterNut:
            if (((this as AbstractPhysicalObject) as WaterNut.AbstractWaterNut).swollen)
            {
                realizedObject = new SwollenWaterNut(this);
            }
            else
            {
                realizedObject = new WaterNut(this);
            }
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.JellyFish:
            realizedObject = new JellyFish(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.Lantern:
            realizedObject = new Lantern(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.KarmaFlower:
            realizedObject = new KarmaFlower(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.Mushroom:
            realizedObject = new Mushroom(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.VoidSpawn:
            realizedObject = new VoidSpawn(this, (Room.realizedRoom == null) ? 0f : Room.realizedRoom.roomSettings.GetEffectAmount(RoomSettings.RoomEffect.Type.VoidMelt), Room.realizedRoom != null && VoidSpawnKeeper.DayLightMode(Room.realizedRoom));
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.FirecrackerPlant:
            realizedObject = new FirecrackerPlant(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)(patch_AbstractPhysicalObject.AbstractObjectType) AbstractPhysicalObject.AbstractObjectType.SlimeMold:
            realizedObject = new SlimeMold(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.FlyLure:
            realizedObject = new FlyLure(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.ScavengerBomb:
            realizedObject = new ScavengerBomb(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.SporePlant:
            realizedObject = new SporePlant(this, world);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.EggBugEgg:
            realizedObject = new EggBugEgg(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.NeedleEgg:
            realizedObject = new NeedleEgg(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.DartMaggot:
            realizedObject = new DartMaggot(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.BubbleGrass:
            realizedObject = new BubbleGrass(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.NSHSwarmer:
            realizedObject = new NSHSwarmer(this);
            break;

        case (patch_AbstractPhysicalObject.AbstractObjectType)AbstractPhysicalObject.AbstractObjectType.OverseerCarcass:
            realizedObject = new OverseerCarcass(this, world);
            break;

        case AbstractObjectType.SmallPiston:
            realizedObject = new SmallPiston(this);
            break;

        case AbstractObjectType.LargePiston:
            realizedObject = new LargePiston(this);
            break;

        case AbstractObjectType.GiantPiston:
            realizedObject = new GiantPiston(this);
            break;
        }
        for (int i = 0; i < stuckObjects.Count; i++)
        {
            if (stuckObjects[i].A.realizedObject == null && stuckObjects[i].A != this)
            {
                stuckObjects[i].A.Realize();
            }
            if (stuckObjects[i].B.realizedObject == null && stuckObjects[i].B != this)
            {
                stuckObjects[i].B.Realize();
            }
        }
    }
Exemple #3
0
    //todo generate new slimemold pixel
    //Move SlimeMold with Speed and move Count Pixel per use
    private void MoveSlimeMold(int speed, int countPixel)
    {
        List <SlimeMold> localSlimeMoldPixels = new List <SlimeMold>();

        if (countPixel <= slimeMoldPixel.Count)
        {
            //amount to check<=Count;
            for (int i = 0; i < countPixel; i++)
            {
                int       random    = UnityEngine.Random.Range(0, slimeMoldPixel.Count - 1);
                SlimeMold slimeMold = slimeMoldPixel[random];
                if (localSlimeMoldPixels.Contains(slimeMold))
                {
                    //i--;
                }
                else
                {
                    localSlimeMoldPixels.Add(slimeMold);
                }
            }
        }
        else
        {
            //
            for (int i = 0; i < slimeMoldPixel.Count; i++)
            {
                int       random    = UnityEngine.Random.Range(0, slimeMoldPixel.Count - 1);
                SlimeMold slimeMold = slimeMoldPixel[random];
                //localSlimeMoldPixels.Add(slimeMold);
                if (localSlimeMoldPixels.Contains(slimeMold))
                {
                    //i--;
                }
                else
                {
                    if (HasAnEpmtySpaceAround(slimeMold.position))
                    {
                        localSlimeMoldPixels.Add(slimeMold);
                    }
                }
            }
        }
        Debug.Log("Chosen Pixels " + localSlimeMoldPixels.Count);
        //new list filled with countPixel
        for (int i = 0; i < localSlimeMoldPixels.Count; i++)
        {
            int count = slimeMoldPixel.FindIndex(item => item.position == localSlimeMoldPixels[i].position);
            if (count == -1)
            {
                //todo
                Debug.Log("Error");
            }
            else
            {
                pixelDataObj[ConvertPositionTo1D(localSlimeMoldPixels[i].position)] = Color.white;//nur wenn bewegt
                slime.Add(new Pos(slimeMoldPixel[count].position));
                SlimeMold currentSlime = new SlimeMold(MoveOrNot(localSlimeMoldPixels[i].position));
                slimeMoldPixel[count] = currentSlime;
            }
        }
    }