Exemple #1
0
    private void Awake()
    {
        if (level == -1)
        {
            //random stage
            stage = DataUtils.getRandomStage(world, GameControl.control.getWorldLevel(world));
        }
        else
        {
            stage = Instantiate(Resources.Load <StageAsset>("LevelAssets/" + world.ToString() + "/" + world.ToString() + level));
            if (wonLastLevel())
            {
                stage = DataUtils.WonLastLvlStage(stage, world, level);
            }
        }

        GameControl.control.GetComponent <Canvas>().enabled           = false;
        GameControl.control.GetComponent <GraphicRaycaster>().enabled = true;

        setBackground();
        PlayerData enemyPlayerData = getEnemyData();

        userPlayer = gameObject.AddComponent <ExplorePlayer>();

        enemyPlayer = gameObject.AddComponent <ExplorePlayer>();

        float CatScale = GameControl.control.playerData.team.Count > enemyPlayerData.team.Count ?
                         getCatScale(GameControl.control.playerData.team.Count) : getCatScale(enemyPlayerData.team.Count);

        userPlayer.init(GameControl.control.playerData, enemyPlayer, catGameObjectPrefab, CatScale, userPos, Vector3.zero, checkGameOver);
        enemyPlayer.setAsEnemy(userPlayer);
        enemyPlayer.init(enemyPlayerData, userPlayer, catGameObjectPrefab, CatScale, enemyPos, new Vector3(0, 180, 0), checkGameOver);

        setUpStart();


        MapManager.StageTransition(1, 0, world, () =>
        {
            if (level == -1)
            {
                string[] randomEncounters = new string[] {
                    enemyPlayerData.team[0].Name + " is happy to see you!",
                    enemyPlayerData.team[0].Name + " is excited to see you!",
                    enemyPlayerData.team[0].Name + " stops you to say hi!",
                    enemyPlayerData.team[0].Name + " wants to play with you!",
                    enemyPlayerData.team[0].Name + " interrupts your journey!",
                    enemyPlayerData.team[0].Name + " confronts you!",
                    "You've been stopped by " + enemyPlayerData.team[0].Name + "!",
                    enemyPlayerData.team[0].Name + " saw you and wants to play!",
                };
                Notify(new string[] {
                    randomEncounters[UnityEngine.Random.Range(0, randomEncounters.Length)]
                }, Init);
                return;
            }
            Init();
        });
    }
Exemple #2
0
 private IEnumerator LoadStageAsync()
 {
     var raceRoomInfo = Resources.Load<RaceRoomInfo> (RES_RACE_ROOM_INFO);
     int raceRoomNo = raceRoomInfo._stageNo;
     var stage = Instantiate<GameObject> (Utilities.stageUtility.GetStageList ()[raceRoomNo]._stagePrefab);
     yield return 0;
     stage.transform.SetParent (transform, false);
     stage.transform.position = Vector3.zero;
     stageAsset = stage.GetComponent<StageAsset> ();
 }