コード例 #1
0
    void SpawnIceblock()
    {
        Iceblock iceblock   = new Iceblock(Resources.Load <EntityPrototype>("Prototypes/Entity/Objects/Iceblock"));
        Vector2i spawnPoint = MapManager.instance.GetRoofTile(new Vector2i(Random.Range(4, Map.mCurrentMap.getMapSize().x - 4), 5));

        iceblock.Spawn(MapManager.instance.GetMapTilePosition(spawnPoint));
    }
コード例 #2
0
    //TODO: I really hate this, I don't want to have to make a class based on an enum
    public void AddObjectEntity(ObjectData data)
    {
        switch (data.type)
        {
        case ObjectType.Chest:
            Chest temp = new Chest(ScriptableObject.Instantiate(mCurrentMap.Data.chestType));
            temp.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.FallingRock:
            FallingRock temp2 = new FallingRock(Resources.Load("Prototypes/Entity/Objects/FallingRock") as EntityPrototype);
            temp2.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.FlowerBed:
            FlowerBed temp3 = new FlowerBed(Resources.Load("Prototypes/Entity/Objects/FlowerBed") as EntityPrototype);
            temp3.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.Tree:
            Tree temp4 = new Tree(Resources.Load("Prototypes/Entity/Objects/Tree") as EntityPrototype);
            temp4.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.Medbay:
            MedicalBay temp5 = new MedicalBay(Resources.Load("Prototypes/Entity/Objects/Medbay") as EntityPrototype);
            temp5.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.Door:
            if (mCurrentMap.mapType != MapType.BossMap)
            {
                Door temp6 = new Door(Resources.Load("Prototypes/Entity/Objects/Door") as DoorPrototype);
                if (mCurrentMap.Data.hasMiniboss)
                {
                    temp6.locked = true;
                }
                temp6.Spawn(GetMapTilePosition(data.TilePosition));
            }
            break;

        case ObjectType.NavSystem:
            NavSystem temp7 = new NavSystem(Resources.Load("Prototypes/Entity/Objects/NavSystem") as EntityPrototype);
            temp7.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.BouncePad:
            BouncePad temp8 = new BouncePad(Resources.Load("Prototypes/Entity/Objects/BouncePad") as EntityPrototype);
            temp8.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.Spikes:
            Spikes temp9 = new Spikes(Resources.Load("Prototypes/Entity/Objects/Spikes") as EntityPrototype);
            temp9.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.Iceblock:
            Iceblock temp10 = new Iceblock(Resources.Load("Prototypes/Entity/Objects/Iceblock") as EntityPrototype);
            temp10.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.AnalysisCom:
            AnalysisCom temp11 = new AnalysisCom(Resources.Load("Prototypes/Entity/Objects/AnalysisCom") as EntityPrototype);
            temp11.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.Item:
            if (data is ItemObjectData itemData)
            {
                ItemObject temp12 = new ItemObject(ItemDatabase.GetItem(itemData.itemType), Resources.Load("Prototypes/Entity/Objects/ItemObject") as EntityPrototype);
                temp12.Spawn(GetMapTilePosition(data.TilePosition));
            }
            break;

        case ObjectType.SmallGatherable:
            Gatherable temp13 = new Gatherable(Resources.Load("Prototypes/Entity/Objects/Gatherables/Small Blue Vein") as GatherablePrototype);
            temp13.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.LargeGatherable:
            Gatherable temp14 = new Gatherable(Resources.Load("Prototypes/Entity/Objects/Gatherables/Large Blue Vein") as GatherablePrototype);
            temp14.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.SaveMachine:
            SaveMachine temp15 = new SaveMachine(Resources.Load("Prototypes/Entity/Objects/SaveMachine") as EntityPrototype);
            temp15.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.BreakableTile:
            BreakableTile temp16 = new BreakableTile(Resources.Load("Prototypes/Entity/Objects/BreakableTile") as EntityPrototype);
            temp16.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.PracticeBot:
            PracticeBot temp17 = new PracticeBot(Resources.Load("Prototypes/Entity/Objects/PracticeBot") as EntityPrototype);
            temp17.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.ShipTeleporter:
            ShipTeleporter temp18 = new ShipTeleporter(Resources.Load("Prototypes/Entity/Objects/ShipTeleporter") as EntityPrototype);
            temp18.Spawn(GetMapTilePosition(data.TilePosition));
            break;

        case ObjectType.MovingPlatform:
            MovingPlatform temp19 = new MovingPlatform(Resources.Load("Prototypes/Entity/Objects/MovingPlatform") as EntityPrototype);
            temp19.Spawn(GetMapTilePosition(data.TilePosition));
            break;
        }
    }