Inheritance: MonoBehaviour
Exemplo n.º 1
0
    public override void DoUpdate(SceneManager context)
    {
        //if((VRInput.Instance.Pitch) < -40){

        //	VRInput.Instance.ReticleColor = new Color(0.2f,0.2f,0.2f,1);
        //}
        //else{
        //	VRInput.Instance.ReticleColor = new Color(0,0,0,0);
        //}

        if(menu.IsClicked){
            SceneManager.Instance.StateTransition(SceneManager.Instance.menuScene);
        }
        else if(restart.IsClicked){
            SceneManager.Instance.StateTransition(SceneManager.Instance.minecartScene);
        }
        else if(nextLab.IsClicked){
            SceneManager.Instance.StateTransition(SceneManager.Instance.relativityScene);
        }

        if(currentSequence == MinecartSequence.None){
            if(minecartA.IsClicked || minecartCartA.IsClicked){
                currentSequence = MinecartSequence.A;
                StartCoroutine(MinecartSequenceA());
            }
            else if(minecartB.IsClicked || minecartCartB.IsClicked){
                currentSequence = MinecartSequence.B;
                StartCoroutine(MinecartSequenceB());
            }
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        //Futile initialization
        //create new FutileParams object, pass types of displays
        FutileParams fparams = new FutileParams(true, true, false, false);
        //Add a resolution level
        fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, "");
        //set origin to center of screen
        fparams.origin = new Vector2(0.5f, 0.5f);
        //finally initialize the fparams object with futile
        Futile.instance.Init(fparams);
        //End Futile initialization

        //Load an Atlas for sprites
        Futile.atlasManager.LoadAtlas("Atlases/SpriteAtlases");

        //create a Sprite
        //FSprite test = new FSprite("grass.png");

        //Display the sprite
        //Futile.stage.AddChild(test);

        sceneManager = new SceneManager();

        sceneManager.ChangeScene(new TitleScene());
    }
Exemplo n.º 3
0
    /// <summary>
    /// Init all roots and configs
    /// </summary>
    void InitFuc()
    {
        
        Application.runInBackground = playInBackGround;
        Debuger.EnableLog = enableDebuger;
        manager = this.gameObject.AddComponent<SceneManager>();
        manager.cacheRoot = transform.FindChild("CacheRoot");
        manager.uiRoot = transform.FindChild("UI Root");
        manager.senceRoot = transform.FindChild("SceneRoot");
        manager.playerRoot = transform.FindChild("PlayerRoot");
        manager.ghostRoot = transform.FindChild("GhostRoot");
        uicamera = manager.uiRoot.FindChild("Camera").GetComponent<UICamera>();
        tool = this.gameObject.AddComponent<Utility>();
        connector = this.gameObject.AddComponent<Connector>();
        this.gameObject.AddComponent<CacheFactory>();
        ConfigFactory.InitResourceConfig();
        ConfigFactory.ReadSystemConfig();
        
        this.gameObject.AddComponent<ConfigInfo>();

        ConfigInfo.ReadUIRules();
        GUIManager.instance.Loading.gameObject.SetActive(true);
        GUIManager.instance.FloatMessagePanel.gameObject.SetActive(true);
        GUIManager.instance.FloatTip.gameObject.SetActive(true);

        GUIManager.LoadingPercent(10);
        ConfigInfo.Init();
        ConfigInfo.InitPreGameConfigs();
        GUIManager.FinishLoading();
        StartGame();
    }
Exemplo n.º 4
0
 void Awake()
 {
     var manager = GameObject.Find("_Managers");
     GameManager = manager.GetComponent<GameManager>();
     SceneManager = manager.GetComponent<SceneManager>();
     MusicManager = manager.GetComponent<MusicManager>();
 }
Exemplo n.º 5
0
 public SceneSeven(SceneManager manager)
     : base(manager)
 {
     timeLength = 4.0f;
     permitUnloadResources = false;
     bigHeadProp = new BigHeadProp(resourceFactory);
 }
Exemplo n.º 6
0
	// ================================================================================================================
	// EXTENDED INTERFACE ---------------------------------------------------------------------------------------------

	void Awake() {
		DontDestroyOnLoad(gameObject);

		instance = this;
		_timer = new GameTimer();
		_sceneManager = new SceneManager();
	}
Exemplo n.º 7
0
    void Awake()
    {
        LevelIndex = Application.loadedLevel;
        instance = this;
        if (controlsManager == null) {
            GameObject newCM = new GameObject("Control_Manager");
            controlsManager = newCM.AddComponent<ControlsManager>();
            newCM.transform.SetParent(this.transform);
        }
        // GET THE SCORE MANAGER //
        if (scoreManager == null) {
            GameObject newScM = new GameObject("Score_Manager");
            scoreManager = newScM.AddComponent<ScoreManager>();
            newScM.transform.SetParent(this.transform);
        }

        // LETS SETUP A SCENE //
        if (sceneManager == null) {
            GameObject newSM = new GameObject("Scene_Manager");
            sceneManager = newSM.AddComponent<SceneManager>();
            newSM.transform.SetParent(this.transform);
        }
        // link the debugger //
        GameObject dbg = GameObject.Find ("Debugger");
        debugger = dbg.GetComponent<Debugger> ();
    }
	public void Awake () 
	{
		_canvas = FindObjectOfType<Canvas>();
		_renderers = FindObjectsOfType<Renderer>();
		_scnManager = FindObjectOfType<SceneManager> ();
		DOTween.Init();
	}
Exemplo n.º 9
0
 public Ninja(ref SceneManager mSceneMgr, Vector3 position)
 {
     ent = mSceneMgr.CreateEntity("Ninja" + count.ToString(), "ninja.mesh");
     ent.CastShadows = true;
     node = mSceneMgr.RootSceneNode.CreateChildSceneNode("NinjaNode" + count.ToString());
     node.AttachObject(ent);
     node.Scale(0.5f, 0.5f, 0.5f);
     node.Position = position;
     name = count++.ToString();
     walkSpeedFactor = 1.0f;
     mAnimationState = ent.GetAnimationState("Idle1");
     mAnimationState.Loop = true;
     mAnimationState.Enabled = true;
     mWalkList = new LinkedList<Vector3>();
     //mWalkList.AddLast(new Vector3(550.0f, 0.0f, 50.0f));
     //mWalkList.AddFirst(new Vector3(-100.0f, 0.0f, -200.0f));
     //mWalkList.AddLast(new Vector3(0.0f, 0.0f, 25.0f));
     forward = Vector3.NEGATIVE_UNIT_Z;
     viewingAngle = 40;
     mAnimationState = ent.GetAnimationState("Walk");
     mAnimationState.Loop = true;
     mAnimationState.Enabled = true;
     mWalking = true;
     rnd = new Random();
     stoneCastle = 0;
     castle = new Vector3();
     castle = Vector3.ZERO;
     nbStoneCastle = 0;
     state = "free";
     ennemySpotted = 0;
     maxView = 200;
 }
Exemplo n.º 10
0
 void Start()
 {
     sceneManager = FindObjectOfType<SceneManager>();
     serialData = FindObjectOfType<SerialData>();
     segment = GetComponentInParent<Segment>();
     thisCollider = GetComponent<Collider>();
 }
Exemplo n.º 11
0
        public SkyManager(SceneManager manager, Camera camera)
        {
            this.manager = manager;
            this.camera = camera;

            NativeHandle = New_Manager(manager.NativePtr, camera.NativePtr);
        }
Exemplo n.º 12
0
    void Start()
    {
        scene_manager = this;

        // Start the first conversation
        StartCoroutine(Start_Scene());
    }
Exemplo n.º 13
0
        protected override void Initialize()
        {
            _sceneManager = new SceneManager();
            _sceneManager.AddScene<GameScene>(new ContentManager(Services, Content.RootDirectory));

            base.Initialize();
        }
Exemplo n.º 14
0
        public MovableText(string name, SceneManager sceneMgr, SceneNode node, Size size)
        {
            this.texture = TextureManager.Singleton.CreateManual(
                name + "Texture",
                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                TextureType.TEX_TYPE_2D,
                (uint)size.Width,
                (uint)size.Height,
                0,
                PixelFormat.PF_A8R8G8B8);

            this.material = MaterialManager.Singleton.Create(name + "Material", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
            this.material.GetTechnique(0).GetPass(0).CreateTextureUnitState(this.texture.Name);
            this.material.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
            this.material.SetDepthCheckEnabled(false);

            this.billboardSet = sceneMgr.CreateBillboardSet();
            this.billboardSet.SetMaterialName(this.material.Name);
            this.billboardSet.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY;

            this.billboard = this.billboardSet.CreateBillboard(Vector3.ZERO);
            this.billboard.SetDimensions(size.Width, size.Height);
            this.billboard.Colour = ColourValue.ZERO;

            node.AttachObject(this.billboardSet);
            this.sceneMgr = sceneMgr;
            this.size = size;
        }
Exemplo n.º 15
0
        /// <summary>
        /// インスタンスを生成します。
        /// </summary>
        /// <param name="settings">チャンク設定。</param>
        /// <param name="graphicsDevice">グラフィックス デバイス。</param>
        /// <param name="regionManager">リージョン マネージャ。</param>
        /// <param name="sceneManager">シーン マネージャ。</param>
        public ChunkManager(
            ChunkSettings settings,
            GraphicsDevice graphicsDevice,
            RegionManager regionManager,
            SceneManager sceneManager)
            : base(settings.PartitionManager)
        {
            if (graphicsDevice == null) throw new ArgumentNullException("graphicsDevice");
            if (regionManager == null) throw new ArgumentNullException("regionManager");

            ChunkSize = settings.ChunkSize;
            this.graphicsDevice = graphicsDevice;
            this.regionManager = regionManager;
            SceneManager = sceneManager;

            switch (settings.ChunkStoreType)
            {
                case ChunkStoreType.Storage:
                    ChunkStore = StorageChunkStore.Instance;
                    break;
                default:
                    ChunkStore = NullChunkStore.Instance;
                    break;
            }

            EmptyData = new ChunkData(this);

            BaseNode = sceneManager.CreateSceneNode("ChunkRoot");
            sceneManager.RootNode.Children.Add(BaseNode);

            meshManager = new ChunkMeshManager(this, settings.VertexBuildConcurrencyLevel, settings.UpdateBufferCountPerFrame);
        }
Exemplo n.º 16
0
    void Start()
    {
        // Stop reorientation weirdness
        // http://answers.unity3d.com/questions/14655/unity-iphone-black-rect-when-i-turn-the-iphone
        Screen.autorotateToPortrait = false;
        Screen.autorotateToPortraitUpsideDown = false;
        Screen.autorotateToLandscapeRight = false;
        Screen.autorotateToLandscapeLeft = false;

        sounds = new Sounds(gameObject);
        sounds.Start();

        var loopTracker = new LoopTracker(sounds);

        var textLabel = new GameObject("prompt text");
        textLabel.SetActive(false);
        var text = textLabel.AddComponent<GUIText>();
        textLabel.transform.position = new Vector3(0f, 0.06f, -9.5f);
        var font = (Font) Resources.Load("sierra_agi_font/sierra_agi_font", typeof(Font));
        text.font = font;

        messageBox = new MessageBox(font);
        var prompt = new Prompt(textLabel, text).build();

        sceneManager = new SceneManager(loopTracker, new MessagePromptCoordinator(prompt, messageBox));
    }
Exemplo n.º 17
0
        public void Load()
        {
            Size clSize = Program.Window.ClientSize;
            camera = new ChaseCamera(clSize.Width / (float)clSize.Height);
            camera.ChaseDirection = new Vector3(0, 0, 1);
            camera.ChasePosition = new Vector3(0, 0, 0);
            camera.DesiredPositionOffset = new Vector3(0, 0, 40);  
            camera.Mode = RenderMode.Final;
            camera.FarPlane = 1000;
            camera.NearPlane = 0.5f;
            camera.RenderTarget = renderSys.GetRenderTarget(0);

            distance = 40;
            yang = MathEx.Degree2Radian(30);
            xang = MathEx.Degree2Radian(45);

            sceneManager = new SceneManager();
            SceneRendererParameter sm = new SceneRendererParameter ();
            sm.PostRenderer = new DefaultPostRenderer();
            sm.SceneManager = sceneManager;
            sm.UseShadow = false;


            renderer = new SceneRenderer(renderSys, sm);

            renderer.RegisterCamera(camera);


            peff = new SmokeEffect(renderSys);
            peff.Emitter = new ParticleEmitter(1);
            peff.Modifier = new ParticleModifier();


            sceneManager.AddObjectToScene(peff);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="mSceneMgr">A reference of the scene manager</param>
 public Ground(SceneManager mSceneMgr)
 {
     this.mSceneMgr = mSceneMgr;
     groundWidth = 1000;
     groundHeight = 1000;
     CreateGround();
 }
Exemplo n.º 19
0
 public override void EnterState(SceneManager context, int idx = 0)
 {
     base.EnterState(context);
     Blackout.Instance.SetColor(Color.white);
     VRInput.Instance.ReticleColor = new Color(0,0,0,0);
     VRInput.Instance.MaxReticleDistance = 5;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="mSceneMgr">A reference of the scene manager</param>
 public Wall(SceneManager mSceneMgr)
 {
     this.mSceneMgr = mSceneMgr;
     wallWidth = 50;
     wallHeight = 1000;
     CreateWall();
 }
Exemplo n.º 21
0
        public void OnLoad()
        {
            var dir = Directory.GetCurrentDirectory();
            ResourceGroupManager.Singleton.AddResourceLocation(dir, "FileSystem");
            MaterialManager.Singleton.Initialise();

            _scene = _root.CreateSceneManager("DefaultSceneManager", "SLSharpInstance");
            _scene.ClearScene();

            Bindings.MOGRE.SLSharp.Init();
            Shader.DebugMode = true;

            //Shader.DebugMode = true;

            _clipmap = new Clipmap(_scene);
            RecalcHeight();

            _camera = _scene.CreateCamera("MainCamera");
            _camera.Position = new Vector3(0, 0, 5);
            _camera.LookAt(Vector3.ZERO);
            _camera.NearClipDistance = 0.001f;
            _camera.FarClipDistance = 20.0f;
            _camera.AutoAspectRatio = true;

            var vp = _window.AddViewport(_camera);
            vp.BackgroundColour = ColourValue.Blue;
        }
Exemplo n.º 22
0
        RenderWindow mWindow; // This field will contain a reference to the rendering window

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mSceneMgr">A reference to the scene manager</param>
        public Env(SceneManager mSceneMgr, RenderWindow mWindow)
        {
            this.mSceneMgr = mSceneMgr;
            this.mWindow = mWindow;

            Load();                                 // This method loads  the environment
        }
        public CometsGameObjectFactory(NessieGame game, SceneManager sceneManager)
            : base(sceneManager)
        {
            this.game = game;

            random = new Random();
        }
Exemplo n.º 24
0
        private float _timeSinceLastFrameLastUpdate; // Time value passed to the last call of the method "Update"

        #endregion Fields

        #region Constructors

        public CameraControlSystem(SceneManager sceneManager, string name, Camera camera = null, bool reCalcOnTargetMoving = true)
        {
            _sceneMgr = sceneManager;
            _name = name;
            _targetNode = null;
            _targetNodeListener = null;
            _recalcOnTargetMoving = reCalcOnTargetMoving;
            _currentCameraMode = null;

            _cameraNode = _sceneMgr.RootSceneNode.CreateChildSceneNode(_name + "SceneNode");

            if (camera == null) {
                _camera = _sceneMgr.CreateCamera(_name);
                _isOwnCamera = true;
            } else {
                _camera = camera;
                _isOwnCamera = false;
            }

            //Reset to default parameters
            _camera.Position = Vector3.ZERO;
            _camera.Orientation = Quaternion.IDENTITY;

            // ... and attach the Ogre camera to the camera node
            _cameraNode.AttachObject(_camera);

            _cameraModes = new Dictionary<string, CameraMode>();
        }
    void Awake()
    {
        _instance = this;

        _sceneList.Add(SceneType.MainMenu, gameObject.AddComponent<MainMenuScene>());
        _sceneList.Add(SceneType.Game, gameObject.AddComponent<GameScene>());
    }
Exemplo n.º 26
0
        public static ManualObject CreateRectangle(SceneManager sceneMgr, Vector3 pos, Vector3 size, string material = ColoredMaterials.BLUE)
        {
            Vector3[,] points = new Vector3[2,4];
            for (int y = 0; y < 2; y++)
            {
                points[y, 0] = pos + y * Vector3.UNIT_Y * size.y;
                points[y, 1] = pos + new Vector3(1, y, 0) * size;
                points[y, 2] = pos + new Vector3(1, y, 1) * size;
                points[y, 3] = pos + new Vector3(0, y, 1) * size;
            }

            ManualObject manOb = sceneMgr.CreateManualObject();
            manOb.Begin(material, RenderOperation.OperationTypes.OT_LINE_LIST);
            for (int y = 0; y < 2; y++)
            {
                for (int i = 0; i < 4; i++)
                {
                    manOb.Position(points[y, i]);
                    manOb.Position(points[y, (i + 1)%4]);
                }
            }

            for (int i = 0; i < 4; i++)
            {
                manOb.Position(points[0, i]);
                manOb.Position(points[1, i]);
            }

            manOb.End();
            return manOb;
        }
Exemplo n.º 27
0
 public static SceneNode DrawLine(SceneManager sceneMgr, Vector3 p1, Vector3 p2, string material = ColoredMaterials.BLUE)
 {
     SceneNode node = sceneMgr.RootSceneNode.CreateChildSceneNode();
     node.Position = p1;
     node.AttachObject(CreateLine(sceneMgr, Vector3.ZERO, p2 - p1, material));
     return node;
 }
Exemplo n.º 28
0
 // CONSTRUCTOR
 public AnimManager(SceneManager sm)
 {
     SM = sm;
     Active = false;
     AnimationLibrary = new Dictionary<string, LinkedList<ANode>>();
     LoadAnimations();
 }
Exemplo n.º 29
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mSceneMgr">A reference to the scene graph</param>
        public CompoundModel(SceneManager mSceneMgr)
        {
            this.mSceneMgr = mSceneMgr;

            Load();
            AssembleModel();
        }
Exemplo n.º 30
0
        public GrassPatchSceneNode(SceneNode parent, SceneManager mgr, int id, bool createIfEmpty,
                                   Vector3D gridPos, string filepath, Texture heightMap, Texture colourMap,
                                   Texture grassMap, SceneNode terrain, WindGenerator wind)
            : base(parent, mgr, id)
        {
            DrawDistance = GRASS_PATCH_SIZE * 1.5f;
            MaxDensity = 800;
            TerrainHeightMap = heightMap;
            TerrainColourMap = colourMap;
            TerrainGrassMap = grassMap;
            Terrain = terrain;
            WindGen = wind;
            lastwindtime = 0;
            lastdrawcount = 0;
            redrawnextloop = true;
            MaxFPS = 0;
            _mgr = mgr;
            WindRes = 5;

            filename = string.Format("{0}/{1}.{2}.grass", filepath, gridpos.X, gridpos.Z);
            gridpos = gridPos;
            Position = new Vector3D(gridpos.X * GRASS_PATCH_SIZE, 0f,
                                    gridpos.Z * GRASS_PATCH_SIZE);

            ImageCount = new Dimension2D(4, 2);

            if (!Load())
                Create(createIfEmpty);
        }
Exemplo n.º 31
0
 private void Awake()
 {
     SceneManager.LoadScene("MainMenu");
 }
Exemplo n.º 32
0
 public void ProgressTo(string name)
 {
     ProgressTo(SceneManager.LoadSceneAsync(name));
 }
Exemplo n.º 33
0
 public void NotifSessionConfirm() {
     SceneManager.LoadScene("Login");
 }
Exemplo n.º 34
0
 public void Logout() {
     LocalData.instance.Unit = null;
     LocalData.instance.DataLast = null;
     LocalData.instance.DataAll = null;
     SceneManager.LoadScene("Login");
 }
Exemplo n.º 35
0
 public void LoadMenu () 
 {
     Time.timeScale = 1f;
     SceneManager.LoadScene("Menu");
 }
Exemplo n.º 36
0
	// Update is called once per frame
	void Update () {
	    if (Input.GetKeyDown(KeyCode.F1))
	    {
	        SceneManager.LoadScene(0);
	    }
	}
    private IEnumerator LoadSampleScene(float time)
    {
        yield return new WaitForSeconds(time);
        SceneManager.LoadScene("SampleScene");

    }
Exemplo n.º 38
0
    // Update is called once per frame
    void Update()
    {
        velocity = new Vector3(0, 0, 0);

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            transform.eulerAngles = new Vector3(0, 0, transform.eulerAngles.z + 200 * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.RightArrow))
        {
            transform.eulerAngles = new Vector3(0, 0, transform.eulerAngles.z - 200 * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.UpArrow))
        {
            velocity += LookAtDirection(transform.eulerAngles.z - 90);
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            velocity -= LookAtDirection(transform.eulerAngles.z - 90);
        }

        for (int i = bullets.Count - 1; i >= 0; i--)
        {
            if (bullets[i] == null)
            {
                bullets.RemoveAt(i);
            }
        }

        if (bullets.Count < 5)
        {
            if (Input.GetKeyDown(KeyCode.M) && !isCounting)
            {
                ShootBallsPlayer2();
            }
        }

        velocity.Normalize();

        if (Input.GetKey(KeyCode.DownArrow))
        {
            rbody.velocity = velocity * (speed - 1f);
        }
        else
        {
            rbody.velocity = velocity * speed;
        }

        if (isCounting == true)
        {
            timer += Time.deltaTime;

            if (timer >= timeToAction)
            {
                Random rand     = new Random();
                int    rand1to5 = rand.Next(1, 4);

                SceneManager.LoadScene("Map " + rand1to5);
                timer = 0;
            }
        }
    }
Exemplo n.º 39
0
 public void LoadCredits()
 {
     Debug.Log("Loading credits");
     SceneManager.LoadScene("Credits");
 }
Exemplo n.º 40
0
 public void game()
 {
     SceneManager.LoadScene(1);
 }
Exemplo n.º 41
0
 public void LoadMenu()
 {
     Debug.Log("Loading menu");
     SceneManager.LoadScene("Menu");
 }
Exemplo n.º 42
0
 public void loadScene(string nameScene)
 {
     SceneManager.LoadScene(nameScene);
     Debug.Log("LoadScene");
 }
 public void Nivel4_1()
 {
     MusicManager.instance.MusicaM4();
     SceneManager.LoadScene(sceneName: "Nivel4_1");
 }
Exemplo n.º 44
0
 public void LoadLevel(int level)
 {
     Debug.Log("Loading level " + level);
     SceneManager.LoadScene(level);
 }
 public void PLogros()
 {
     SceneManager.LoadScene(sceneName: "Menu_trofeos");
 }
 public void Nivel5_2()
 {
     MusicManager.instance.MusicaM5();
     SceneManager.LoadScene(sceneName: "Nivel5_2");
 }
 public void MenuInicial()
 {
     SceneManager.LoadScene(sceneName: "Menu_principal");
 }
 public void Mundo5()
 {
     SceneManager.LoadScene(sceneName: "Mundo5");
 }
Exemplo n.º 49
0
 public void PlayGame()
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
 }
 public void MenuSeleccion()
 {
     SceneManager.LoadScene(sceneName: "Menu_seleccion_mundo");
 }
Exemplo n.º 51
0
 public void resetscene()
 {
     SceneManager.LoadScene("main");
 }
Exemplo n.º 52
0
    IEnumerator EndEverythingCoroutine()
    {
        yield return(new WaitForSeconds(CreditsLength));

        SceneManager.LoadScene("MainMenuScene");
    }
Exemplo n.º 53
0
 IEnumerator gameOver ()
 {
     mainBgm.GetComponent<AudioSource>().Stop();
     yield return new WaitForSeconds(5);
     SceneManager.LoadScene("GameOver");
 }
Exemplo n.º 54
0
 public void loadLevel3()
 {
     FindObjectOfType <GameSession>().resetScore();
     SceneManager.LoadScene(3);
 }
Exemplo n.º 55
0
 public void Continue()
 {
     SceneManager.LoadScene(PlayerPrefs.GetInt("levelReached"), LoadSceneMode.Single);
 }
Exemplo n.º 56
0
 private void Restart()
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
Exemplo n.º 57
0
    public void StartDemoGame()
    {
        #region OrdersExamples

        MoveOrderInitParams MoveExample = new MoveOrderInitParams("Move");
        AttackOrderInitParams AttackExample = new AttackOrderInitParams("Attack");
        MoveAttackOrderInitParams MoveAttackExample = new MoveAttackOrderInitParams("Move and attack");

        Dictionary<string,BuildOrderInitParams> BuildExamples = new Dictionary<string,BuildOrderInitParams>();

        foreach (Building var in BuildingsToLoad)
        {
            if (var is MainHub) continue;
            BuildExamples.Add(typeof(BuildOrderInitParams).FullName + "."+ var.name,new BuildOrderInitParams(var, "Build "+var.name));
        }

        Dictionary<string, UnitCreationOrderInitParams> UnitCreationExamples =
            new Dictionary<string, UnitCreationOrderInitParams>();

        foreach (Unit unit in UnitsToLoad)
        {
            UnitCreationExamples.Add(typeof(UnitCreationOrderInitParams).FullName + "." + unit.name, new UnitCreationOrderInitParams(unit, 1f, "Create unit " + unit.name));
        }

        #endregion
        
        EntityLoader.ClearDictionary();

        #region UnitLoadInitialization

        foreach (Unit unit in UnitsToLoad)
        {
            if (unit is Warrior)
            {
                LoadEntetyData warrioEntetyData = new LoadEntetyData(unit.gameObject,new Dictionary<string, GameOrderInitParams>
                {
                    {MoveExample.ToString() ,MoveExample},
                    {AttackExample.ToString() ,AttackExample},
                    {MoveAttackExample.ToString() ,MoveAttackExample},
                });
                
                EntityLoader.AddNewEntetyTypeToDictionary(unit.GetType(), warrioEntetyData);
            }
            else if (unit is UnitBuilder)
            {
                Dictionary<string, GameOrderInitParams> AllOrdersExamples = new Dictionary<string, GameOrderInitParams>();
                foreach (KeyValuePair<string,BuildOrderInitParams> keyValuePair in BuildExamples)
                {
                    AllOrdersExamples.Add(keyValuePair.Key,keyValuePair.Value);
                }
                
                AllOrdersExamples.Add(MoveExample.ToString(),MoveExample);

                LoadEntetyData builderEntetyData =
                    new LoadEntetyData(unit.gameObject, AllOrdersExamples);

                EntityLoader.AddNewEntetyTypeToDictionary(unit.GetType(), builderEntetyData);
            }
            else
            {
                LoadEntetyData builderEntetyData =
                    new LoadEntetyData(unit.gameObject, new Dictionary<string, GameOrderInitParams>
                    {
                        {MoveExample.ToString() ,MoveExample}
                    });

                EntityLoader.AddNewEntetyTypeToDictionary(unit.GetType(), builderEntetyData);
            }

        }

        #endregion

        #region BuildingLoadInitialization

        foreach (Building building in BuildingsToLoad)
        {
            if (building is MainHub)
            {
                Dictionary<string, GameOrderInitParams> AllOrdersExamples = new Dictionary<string, GameOrderInitParams>();
                
                foreach (KeyValuePair<string,UnitCreationOrderInitParams> keyValuePair in UnitCreationExamples)
                {
                    AllOrdersExamples.Add(keyValuePair.Key,keyValuePair.Value);
                }
                
                LoadEntetyData HubLoadData = new LoadEntetyData(building.gameObject, AllOrdersExamples);
                
                EntityLoader.AddNewEntetyTypeToDictionary(building.GetType(),HubLoadData);
            }
        }

        #endregion
        
        SceneManager.LoadScene(DemoSceneIndex);
    }
Exemplo n.º 58
0
 public void Replay()
 {
     panel.SetActive(false);
     SceneManager.LoadScene("GamePlay");
 }
Exemplo n.º 59
0
 public void ProgressTo(int level)
 {
     ProgressTo(SceneManager.LoadSceneAsync(level));
 }
Exemplo n.º 60
0
 public void StartGame()
 {
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
     PlayerPrefs.SetInt("levelReached", SceneManager.GetActiveScene().buildIndex + 1);
 }