Esempio n. 1
0
 // Use this for initialization
 void Awake()
 {
     //get bricksManager for tag;
     this._bricksManager = GameObject.FindGameObjectWithTag("Building").gameObject.GetComponent <BricksManager>();
     this._gManager      = GameObject.FindGameObjectWithTag("GameController").gameObject.GetComponent <BrickGameManager> ();
     this.changeObjMaterialColor(this._rightObj, this._rightColor);
     this.changeObjMaterialColor(this._falseObj, this._falseColor);
 }
Esempio n. 2
0
 private void Awake()
 {
     if (_instance != null) {
         Destroy (gameObject);
     } else {
         _instance = this;
     }
 }
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
         //DontDestroyOnLoad(this.gameObject);
     }
 }
Esempio n. 4
0
        public void Initialize()
        {
            _playerInformations = new PlayerInformation("Joueur 1");
            _levelHUD           = new LevelHUD(this, _playerInformations);
            _palet              = new Palet(this);
            _balle              = new Balle(this);
            _balle.balleMissed += this.BalleMissed_Event;
            _bricksManager      = new BricksManager(this);

            removeSpriteIndex = -1;
            canPlay           = true;
            retry             = false;

            allSprites.Clear();

            _levelHUD.Initialize();
            _palet.Initialize();
            _balle.Initialize();
            _bricksManager.Initialize();

            // Le palet est en première position dans la collection
            // La balle à la deuxième position, cela permet de ne pas itérer toute la collection
            // pour trouver une collision
            allSprites.Insert(0, _palet);
            allSprites.Insert(1, _balle);

            foreach (Brick b in _bricksManager.ListBricks)
            {
                b.brickDestroyed += this.BrickAsDestroyed_Event;
                allSprites.Add(b);
            }

            foreach (Sprite s in allSprites)
            {
                s.Scale = spriteScale;
            }
        }
Esempio n. 5
0
    // Use this for initialization
    public void Awake()
    {
        if (GameObject.Find("Frameworks") == null)
        {
            GameObject fmObj = Instantiate(Resources.Load("Presets/Frameworks")) as GameObject;
            fmObj.name = "Frameworks";
        }

        if (GameObject.FindGameObjectWithTag("PlayerData") == null)
        {
            GameObject _dataplayer = Instantiate(Resources.Load("Presets/PlayerData")) as GameObject;
            _profile = _dataplayer.GetComponent<PlayerData>();
            _profile.Launch();
        }
        else
        {
            _profile = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>();
            _profile.Launch();
        }

        if (_profile.SETUP.GameType == GameSetup.versionType.Demo)
        {
        //			Screen.SetResolution(800,600, false);
        //			GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().pixelPerfectResolution = new Vector2(800f,600f);
        //			GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().alwaysPixelPerfect = true;
        //			GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().customSize = 4;
        }

        GAMESTATE = _EditorState;
        _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
        GlobTuning = Instantiate(Resources.Load("Tuning/Global")) as LPTuning;
        InputMan = Instantiate(Resources.Load("Tuning/InputManager")) as InputManager;
        CurrentLevelInfo = Instantiate(Resources.Load("Tuning/Levels/" + NAME)) as LevelInfo;

        LocalTuning = Instantiate(Resources.Load("Maps/" + NAME + "/Setup")) as LevelParameters;
        LocalTuning.initScript();

        GameObject OutSpw = new GameObject("OuterSpawn");
        OuterSpawn = OutSpw;
        OuterSpawn.transform.parent = FETool.findWithinChildren(this.gameObject, "Enviro").transform;
        OuterSpawn.transform.position = new Vector3(0f, -7.5f, 0f);

        tools = gameObject.AddComponent<LevelTools>();
        tools._levMan = this;
        TranslateAllInScene();

        CollectiblePlaces[] collecPla = FETool.findWithinChildren(this.gameObject, "Enviro/CollectiblePlaces").GetComponentsInChildren<CollectiblePlaces>();
        foreach (CollectiblePlaces cpl in collecPla)
        {
            collecPlaces.Add(cpl);
        }
        Gate = GameObject.FindGameObjectWithTag("SpaceGate").GetComponent<SpaceGate>();
        Gate.Setup(this);

        wpDirector = GetComponentInChildren<WaypointDirector>();
        wpDirector.Setup(this);

        bricksMan = FETool.findWithinChildren(this.gameObject, "LevelBricks/Bricks").GetComponent<BricksManager>();
        bricksMan.Setup();

        if (GAMETYPE != LocalTuning.levelType)
        {
            Debug.Log("Type of LevelMana & Setup scrip arent't the same");
        }
        GAMETYPE = LocalTuning.levelType;
        switch (GAMETYPE)
        {
        case LevelParameters.levelTypeList.Debuggin :
        {
            linearTrigger = gameObject.AddComponent<LinearStepTrigger>();
            linearTrigger.Setup(this);
            break;
        }
        case LevelParameters.levelTypeList.Linear :
        {
            linearTrigger = gameObject.AddComponent<LinearStepTrigger>();
            linearTrigger.Setup(this);
            break;
        }
        case LevelParameters.levelTypeList.Maze :
        {
            break;
        }
        case LevelParameters.levelTypeList.Procedural :
        {
            GameObject gameo = FETool.createGameObject("ProceduralManager", gameObject);
            ProcMana = gameo.AddComponent<Procedural>();
            ProcMana.Setup(this);
            break;
        }
        case LevelParameters.levelTypeList.Vertical :
        {
            GameObject vm = new GameObject("VerticalManager");
            VerticalManager = vm.AddComponent<VerticalScroller>();
            vm.transform.parent = this.transform;
            VerticalManager.Setup(this);
            break;
        }
        }

        wpDirector.affectRelatedBricks(bricksMan.BricksList);

        if (LocalTuning.levelType != LevelParameters.levelTypeList.Debuggin)
        {
            if (GameObject.Find("UI") == null)
            {
                GameObject uiman = Instantiate(Resources.Load("Presets/UI")) as GameObject;
                uiman.name = "UI";
                menuManager = uiman.GetComponent<MainMenu>();
            }
            else
            {
                menuManager = GameObject.Find("UI").GetComponent<MainMenu>();
            }
        }
        if (menuManager != null)
        {
            menuManager.Setup(this);
        }
        managerChecker();
        //		proc.triggerStep(proc._listSteps[0]);
        _player.Setup();
        Setup();
    }