Beispiel #1
0
 public void AIMapReady()
 {
     orig_AIMapReady();
     if (room.roomSettings.GetEffectAmount((RoomSettings.RoomEffect.Type)patch_RoomSettings.patch_RoomEffect.Type.LMSwarmers) > 0f)
     {
         bool         dark            = room.roomSettings.Palette == 24 || (room.roomSettings.fadePalette != null && room.roomSettings.fadePalette.palette == 24);
         IntVector2[] accessableTiles = room.aimap.CreatureSpecificAImap(StaticWorld.GetCreatureTemplate(CreatureTemplate.Type.Fly)).accessableTiles;
         int          num             = (int)((float)accessableTiles.Length * 0.05f * room.roomSettings.GetEffectAmount((RoomSettings.RoomEffect.Type)patch_RoomSettings.patch_RoomEffect.Type.LMSwarmers));
         System.Collections.Generic.List <IntVector2> list = new System.Collections.Generic.List <IntVector2>();
         for (int i = 0; i < num; i++)
         {
             list.Add(accessableTiles[UnityEngine.Random.Range(0, accessableTiles.Length)]);
         }
         LMOracleSwarmer.Behavior behavior = null;
         for (int j = 0; j < list.Count; j++)
         {
             LMOracleSwarmer LMOracleSwarmer = new LMOracleSwarmer(new AbstractPhysicalObject(room.world, (AbstractPhysicalObject.AbstractObjectType)patch_AbstractPhysicalObject.AbstractObjectType.LMOracleSwarmer, null, room.GetWorldCoordinate(list[j]), room.game.GetNewID()), room.world);
             LMOracleSwarmer.abstractPhysicalObject.destroyOnAbstraction = true;
             LMOracleSwarmer.firstChunk.HardSetPosition(room.MiddleOfTile(list[j]));
             LMOracleSwarmer.system           = this;
             LMOracleSwarmer.waitToFindOthers = j;
             LMOracleSwarmer.dark             = dark;
             if (behavior == null)
             {
                 behavior = LMOracleSwarmer.currentBehavior;
             }
             else
             {
                 LMOracleSwarmer.currentBehavior = behavior;
             }
             room.AddObject(LMOracleSwarmer);
             LMOracleSwarmer.NewRoom(room);
         }
     }
 }
Beispiel #2
0
 public Behavior(LMOracleSwarmer leader)
 {
     this.leader   = leader;
     dom           = UnityEngine.Random.value;
     idealDistance = Mathf.Lerp(10f, 300f, UnityEngine.Random.value * UnityEngine.Random.value);
     life          = 1f;
     if (UnityEngine.Random.RandomRange(0f, 1f) > 0.9f)
     {
         life = 0f;
     }
     deathSpeed       = 1f / Mathf.Lerp(40f, 220f, UnityEngine.Random.value);
     color            = new Vector2((float)UnityEngine.Random.Range(0, 3) / 2f, (UnityEngine.Random.value >= 0.75f) ? 1f : 0f);
     aimInFront       = Mathf.Lerp(40f, 300f, UnityEngine.Random.value);
     torque           = ((UnityEngine.Random.value >= 0.5f) ? Mathf.Lerp(-1f, 1f, UnityEngine.Random.value) : 0f);
     randomVibrations = UnityEngine.Random.value * UnityEngine.Random.value * UnityEngine.Random.value;
     revolveSpeed     = ((UnityEngine.Random.value >= 0.5f) ? 1f : -1f) / Mathf.Lerp(15f, 65f, UnityEngine.Random.value);
     suckle           = (UnityEngine.Random.value < 0.166666672f);
 }
    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();
            }
        }
    }