Beispiel #1
0
    private void init()
    {
        Vars.initVars();
        Vars.inSpace = true;

        ItemFactory.itemPrefab = itemPrefab;
        mainCamera             = Camera.main.transform;

        Imager.initialize();
        Player.init();

        GameObject.Find("Images Provider").GetComponent <ImagesProvider>().init();

        starField = GameObject.Find("StarField").GetComponent <StarField>().init();
        star      = transform.Find("Star").GetComponent <SpriteRenderer>();
        star.gameObject.SetActive(true);

        ItemDescriptor descriptor = GameObject.Find("Item Descriptor").GetComponent <ItemDescriptor>().init();

        statusScreen = GameObject.Find("Status Screen").GetComponent <StatusScreen>().init(this, descriptor);

        descriptor.playerData = statusScreen.playerData;

        if (Vars.shipCurrentHealth == -1)
        {
            statusScreen.shipData.initializeRandomShip(HullType.ARMAGEDDON);
            statusScreen.inventory.setCapacity(statusScreen.shipData.hullType.getStorageCapacity());
        }
        else
        {
            statusScreen.initFromVars();
        }

        initPlayerShip();

        statusScreen.cameraController = cameraController;

        Vars.userInterface = GameObject.FindGameObjectWithTag("UserInterface").GetComponent <UserInterface>().init(statusScreen, this, playerShip);

        shieldsPool = GameObject.Find("ShieldsPool").GetComponent <ShieldsPool>();

        explosionsManager = GameObject.Find("Explosions Manager").GetComponent <ExplosionsManager>().init();

        lootDropper = GameObject.Find("Loot Dropper").GetComponent <LootDropper>().init(statusScreen.inventory, descriptor);

        spawner = GetComponent <EnemySpawner>().init(Vars.userInterface.minimap, playerShip.transform);

        loadStarSystem();

        gamePaused = false;
    }
Beispiel #2
0
    protected void initInner()
    {
        if (weaponSlotsMap == null)
        {
            initializeWeaponSlotsMap();
            initializeEngineMap();
            initializeColliderMap();
            initializeExhaustMap();
        }

        engine       = transform.FindChild("Engine").GetComponent <Engine>();
        shieldsPool  = GameObject.Find("ShieldsPool").GetComponent <ShieldsPool>();
        shipCollider = transform.GetComponent <BoxCollider2D>();
        controller   = transform.GetComponent <ShipController>();

        destroed             = false;
        alive                = true;
        shipCollider.enabled = true;
    }