Beispiel #1
0
 public static void TriggerGameOver(LevelTools.KillerList _killer)
 {
     if(GameOver != null && LevelManager.GAMESTATE != GameState.GameOver)
     {
         switch (_killer)
         {
         case  LevelTools.KillerList.Bird :
         {
             MasterAudio.PlaySound("death_bat");
             break;
         }
         case  LevelTools.KillerList.Chainsaw :
         {
             MasterAudio.PlaySound("death_saw");
             break;
         }
         case  LevelTools.KillerList.Lava :
         {
             MasterAudio.PlaySound("death_fall");
             break;
         }
         }
     //			Debug.LogWarning("GAMEOVER "+ _killer);
         gameOver = true;
         LevelManager.GAMESTATE = GameState.GameOver;
         GameOver();
     }
 }
Beispiel #2
0
    public void Build(int id)
    {
        spawner.SetLevelId(id);
        spawner.Spawn();
        var targets = new Targets(
            LevelTools.GetLevelTargetCount(id),
            UnityEngine.GameObject.FindObjectsOfType <Agent>().Length,
            0
            );
        var p = new Parameters(
            LevelTools.GetLevelTime(id),
            targets);

        level.Setup(p);
    }
Beispiel #3
0
 public void createBladePart(int _nbFireballs, LevelTools.DirectionList _dir)
 {
     for (int i = 0; i < _nbFireballs ; i++)
     {
         GameObject gameo = Instantiate(Resources.Load("Bricks/Opponent/BladePart")) as GameObject;
         BladePart fb = gameo.GetComponent<BladePart>();
         fb.Direction = _dir;
         switch (fb.Direction)
         {
         case LevelTools.DirectionList.Down :
         {
             FbListDown.Add(fb);
             fb.transform.parent = parDown.transform;
             break;
         }
         case LevelTools.DirectionList.Up :
         {
             FbListUp.Add(fb);
             fb.transform.parent = parUp.transform;
             break;
         }
         case LevelTools.DirectionList.Right :
         {
             FbListRight.Add(fb);
             fb.transform.parent = parRight.transform;
             break;
         }
         case LevelTools.DirectionList.Left :
         {
             FbListLeft.Add(fb);
             fb.transform.parent = parLeft.transform;
             break;
         }
         }
         fb.transform.localPosition = new Vector3(0f,0f,0f);
     //			fb.transform.localPosition = new Vector3(0f,0f,0f);
         FbList.Add(fb);
     }
 }
Beispiel #4
0
 public void giveDirection(LevelTools.DirectionList _dir)
 {
     transform.position = linkedTower.transform.position;
     transform.localPosition = new Vector3(0f,0f,0f);
     arrDirection = _dir;
     Busy = true;
     switch (arrDirection)
     {
         case LevelTools.DirectionList.Up :
         {
         target = Vector3.up;
         transform.rotation = Quaternion.Euler( new Vector3(0f,0f,90f));
     //			transform.position += new Vector3(0f, Padding, 0f);
         break;
         }
         case LevelTools.DirectionList.Down :
         {
         target = Vector3.down;
         transform.rotation = Quaternion.Euler( new Vector3(0f,0f,270f));
         break;
         }
         case LevelTools.DirectionList.Left :
         {
         target = Vector3.left;
         transform.rotation = Quaternion.Euler( new Vector3(0f,0f,180f));
         break;
         }
         case LevelTools.DirectionList.Right :
         {
         target = Vector3.right;
         transform.rotation = Quaternion.Euler( new Vector3(0f,0f,0f));
         break;
         }
     }
     //		StartCoroutine("FadeAway");
 }
Beispiel #5
0
 public void tryDeath(LevelTools.KillerList _kl)
 {
     GameEventManager.TriggerGameOver(_kl);
 }
Beispiel #6
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();
    }