// Use this for initialization
 void Start()
 {
     if (!pad)
     {
         pad = transform.parent.GetComponent <BouncePad>();
     }
 }
Esempio n. 2
0
        public override void LoadContent()
        {
            base.LoadContent();
            timer   = 0;
            player  = new Player(new Rectangle(600, 500, 50, 50));
            player2 = new Player(new Rectangle(800, 800, 50, 50));

            Platform  platform  = new Platform("Platform", new Rectangle(700, 800, 100, 30));
            Platform  platform2 = new Platform("Platform", new Rectangle(600, 900, 100, 30));
            Platform  platform3 = new Platform("Platform", new Rectangle(550, 700, 100, 30));
            Platform  platform4 = new Platform("Platform", new Rectangle(0, 950, 10000, 30));
            Platform  platform5 = new Platform("Platform", new Rectangle(1000, 400, 30, 600));
            Spike     spike     = new Spike("Spike", new Rectangle(900, 900, 30, 100));
            BouncePad bouncePad = new BouncePad("BouncePad", new Rectangle(200, 950, 60, 10));
            Pillow    pillow    = new Pillow("Pillow", new Rectangle(300, 920, 30, 20));

            sprites.Add(platform);
            sprites.Add(platform2);
            sprites.Add(platform3);
            sprites.Add(platform4);
            sprites.Add(platform5);
            sprites.Add(player2);
            sprites.Add(player);
            sprites.Add(spike);
            sprites.Add(bouncePad);
            sprites.Add(pillow);

            foreach (var s in sprites)
            {
                s.LoadContent(Content);
            }
            controller  = new GameController(1);
            controller2 = new GameController(2);
        }
Esempio n. 3
0
    /// Returns a bounce pad back to the pool and resets it.
    public void ReturnToPool(BouncePad pad)
    {
        _ActivePads.Remove(pad);
        _InactivePads.Add(pad);

        pad.gameObject.SetActive(false);
        pad.transform.position = Vector3.zero;
    }
    //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;
        }
    }