示例#1
0
 public void Dispose()
 {
     _randDir?.Dispose();
     _randDir = null;
     Endless?.Dispose();
     Endless = null;
 }
示例#2
0
    // Methods
    private void execAction()
    {
        ArrayList newPosStruct = Endless.getNewPositionStruct(playerObject.transform.position);

        if ((bool)newPosStruct[0] == true)
        {
            playerObject.transform.position = (Vector3)newPosStruct[1];
        }
    }
示例#3
0
 static void Main(string[] args)
 {
     using (Endless game = new Endless())
     {
     #if !DEBUG
         game.IsFullScreen = true;
     #endif
         game.Run();
     }
 }
示例#4
0
    private void setObjective()
    {
        // Create an Objective based on the type provided by the TileMap
        switch (GameTileMapReference.ObjectiveType)
        {
        case Objectives.Type.KillAll:
            CurrentObjective         = gameObject.AddComponent <Kill_Enemy>();
            CurrentObjective.Manager = this;
            break;

        case Objectives.Type.CollectCoins:
            CurrentObjective         = gameObject.AddComponent <Collect_Coins>();
            CurrentObjective.Manager = this;
            break;

        case Objectives.Type.NoDamage:
            CurrentObjective         = gameObject.AddComponent <No_Dmg_Taken>();
            CurrentObjective.Manager = this;
            break;

        case Objectives.Type.Endless:
            CurrentObjective = gameObject.AddComponent <Endless>();
            Endless mode = CurrentObjective.GetComponent <Endless>();
            mode.RefPlayer1          = PlayerList[0];
            mode.RefPlayer2          = PlayerList[1];
            mode.RefEnemyManager     = EnemiesManager;
            mode.RefWaypointManager  = GetComponentInChildren <WaypointManager>();
            CurrentObjective.Manager = this;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        // Initialize the Objective with the string provided
        if (CurrentObjective.ParseParamString(GameTileMapReference.ObjectiveParams) == false)
        {
            throw new UnityException("Failed to load Objective parameters!");
        }

        // Tie the Objective with this GameManager
        CurrentObjective.Manager = this;
    }
示例#5
0
    void Start()
    {
        //Disable everything before game starts
        M         = GameObject.Find("character").GetComponent <Movement> ();
        M.enabled = false;

        pc         = GameObject.Find("Main Camera").GetComponent <PlayerCamera> ();
        pc.enabled = false;

        S         = GameObject.Find("character").GetComponent <swipe> ();
        S.enabled = false;

        E         = GameObject.Find("platform").GetComponent <Endless> ();
        E.enabled = false;

        E1         = GameObject.Find("Cube1").GetComponent <Endless> ();
        E1.enabled = false;

        E2         = GameObject.Find("Cube2").GetComponent <Endless> ();
        E2.enabled = false;

        E3         = GameObject.Find("Death").GetComponent <Endless> ();
        E3.enabled = false;

        r         = GameObject.Find("GameOver").GetComponent <restart> ();
        r.enabled = false;

        tt         = GameObject.Find("misc").GetComponent <Timer> ();
        tt.enabled = false;

        TapToStart     = GameObject.Find("Button");
        Gear           = GameObject.Find("Button1");
        GameOverScreen = GameObject.Find("GameOver");
        SelectScreen   = GameObject.Find("CSS");
        Score          = GameObject.Find("Score");
        BestScore      = GameObject.Find("Best");

        GameOverScreen.SetActive(false);
        SelectScreen.SetActive(false);
        Score.SetActive(false);
    }
示例#6
0
 void Awake()
 {
     singleton = this;
 }
示例#7
0
    // Methods
    private void Start()
    {
        ms_Singleton = this;
        if (tOrg == null)
        {
            this.tOrg = Terrain.activeTerrain;
        }
        this.xlength = this.tOrg.terrainData.size.x;
        this.zlength = this.tOrg.terrainData.size.z;

        for (int i = 0; i < 8; i++)
        {
            Vector3 position = this.tOrg.transform.position;
            switch (i)
            {
            case 0:
                position.x += this.xlength;
                position.z += this.zlength;
                break;

            case 1:
                position.x += this.xlength;
                position.z += 0f;
                break;

            case 2:
                position.x += this.xlength;
                position.z -= this.zlength;
                break;

            case 3:
                position.x += 0f;
                position.z -= this.zlength;
                break;

            case 4:
                position.x -= this.xlength;
                position.z -= this.zlength;
                break;

            case 5:
                position.x -= this.xlength;
                position.z += 0f;
                break;

            case 6:
                position.x -= this.xlength;
                position.z += this.zlength;
                break;

            case 7:
                position.x += 0f;
                position.z += this.zlength;
                break;
            }



            GameObject go           = Terrain.CreateTerrainGameObject((TerrainData)GameObject.Instantiate(this.tOrg.terrainData));
            Terrain    terrainClone = go.GetComponent <Terrain>();
            terrainClone.transform.position = position;
            switch (i)
            {
            case 0:
                terrainTopRight = terrainClone;
                break;

            case 1:
                terrainRight = terrainClone;
                break;

            case 2:
                terrainBottomRight = terrainClone;
                break;

            case 3:
                terrainBottom = terrainClone;
                break;

            case 4:
                terrainBottomLeft = terrainClone;
                break;

            case 5:
                terrainLeft = terrainClone;
                break;

            case 6:
                terrainTopLeft = terrainClone;
                break;

            case 7:
                terrainTop = terrainClone;
                break;
            }
        }
        //(left : Terrain, top : Terrain, right : Terrain, terrain, Bottom : Terrain
        terrainTopRight.SetNeighbors(terrainTop, null, null, terrainRight);
        terrainBottomRight.SetNeighbors(terrainBottom, terrainRight, null, null);
        terrainBottomLeft.SetNeighbors(null, terrainLeft, terrainBottom, null);
        terrainTopLeft.SetNeighbors(null, null, terrainTop, terrainLeft);

        terrainRight.SetNeighbors(tOrg, terrainTopRight, null, terrainBottomRight);
        terrainLeft.SetNeighbors(null, terrainTopLeft, tOrg, terrainBottomLeft);
        terrainTop.SetNeighbors(terrainTopLeft, null, terrainTopRight, tOrg);
        terrainBottom.SetNeighbors(terrainBottomLeft, tOrg, terrainBottomRight, null);

        this.tOrg.SetNeighbors(terrainLeft, terrainTop, terrainRight, terrainBottom);

        adjustTerrainHeights(terrainRight, "right");
        adjustTerrainHeights(terrainTopRight, "right");
        adjustTerrainHeights(terrainBottomRight, "right");
        adjustTerrainHeights(terrainLeft, "left");
        adjustTerrainHeights(terrainTopLeft, "left");
        adjustTerrainHeights(terrainBottomLeft, "left");
        adjustTerrainHeights(terrainTop, "top");
        adjustTerrainHeights(terrainTopRight, "top");
        adjustTerrainHeights(terrainTopLeft, "top");
        adjustTerrainHeights(terrainBottom, "bottom");
        adjustTerrainHeights(terrainBottomRight, "bottom");
        adjustTerrainHeights(terrainBottomLeft, "bottom");

        if (targetFrameRate != 0)
        {
            Application.targetFrameRate = targetFrameRate;
        }

        if (cameraFarClipPlane != 0f)
        {
            Camera.main.farClipPlane = cameraFarClipPlane;
        }

        checkUpdate();
    }
示例#8
0
文件: Variables.cs 项目: inau/gravity
    // Use this for initialization
    void Start()
    {
        if (MomentumLabel == null)
        {
            MomentumLabel = this.transform.Find("MomentumLabel").GetComponent <Text>();
        }

        if (overviewToggle == null)
        {
            overviewToggle = this.transform.Find("OverViewToggle").GetComponent <Toggle>();
        }

        if (widthInput == null)
        {
            widthInput = this.transform.Find("MainMenu/SubMenu/Dev/MapW").GetComponent <InputField>();
        }

        if (heightInput == null)
        {
            heightInput = this.transform.Find("MainMenu/SubMenu/Dev/MapH").GetComponent <InputField>();
        }

        //main menu
        if (Level == null)
        {
            Level = this.transform.Find("MainMenu/Level").GetComponent <Button>();
        }

        if (Puzzle == null)
        {
            Puzzle = this.transform.Find("MainMenu/Puzzle").GetComponent <Button>();
        }

        if (Endless == null)
        {
            Endless = this.transform.Find("MainMenu/Endless").GetComponent <Button>();
        }

        if (Scavenger == null)
        {
            Scavenger = this.transform.Find("MainMenu/Scavenger").GetComponent <Button>();
        }

        if (reset == null)
        {
            reset = this.transform.Find("MainMenu/Reset").GetComponent <Button>();
        }

        if (MainMenuToggle == null)
        {
            MainMenuToggle = this.transform.Find("MainMenu").GetComponent <UIGroupToggle>();
        }

        Level.OnClickAsObservable().Subscribe(_ => GlobalVariables.variablesRx.mode.Value     = Global.Enumerations.GameMode.LEVELS).AddTo(Level);
        Puzzle.OnClickAsObservable().Subscribe(_ => GlobalVariables.variablesRx.mode.Value    = Global.Enumerations.GameMode.PUZZLE).AddTo(Puzzle);
        Endless.OnClickAsObservable().Subscribe(_ => GlobalVariables.variablesRx.mode.Value   = Global.Enumerations.GameMode.ENDLESS).AddTo(Endless);
        Scavenger.OnClickAsObservable().Subscribe(_ => GlobalVariables.variablesRx.mode.Value = Global.Enumerations.GameMode.SCAVENGER).AddTo(Scavenger);
        reset.OnClickAsObservable().Subscribe(_ => player.reset()).AddTo(reset);

        GlobalVariables.variablesRx.mode.Subscribe(x => this.SetColor(x == Global.Enumerations.GameMode.LEVELS, Level)).AddTo(Level);
        GlobalVariables.variablesRx.mode.Subscribe(x => this.SetColor(x == Global.Enumerations.GameMode.PUZZLE, Puzzle)).AddTo(Puzzle);
        GlobalVariables.variablesRx.mode.Subscribe(x => this.SetColor(x == Global.Enumerations.GameMode.ENDLESS, Endless)).AddTo(Endless);
        GlobalVariables.variablesRx.mode.Subscribe(x => this.SetColor(x == Global.Enumerations.GameMode.SCAVENGER, Scavenger)).AddTo(Scavenger);

        //hook rx components into
        GlobalVariables.variablesRx.player_screen_coordinates.SubscribeToText(MomentumLabel).AddTo(MomentumLabel);

        GlobalVariables.preferencesRx.camera_overview.Subscribe(x => overviewToggle.isOn = x).AddTo(overviewToggle);
        overviewToggle.OnValueChangedAsObservable()
        .Subscribe(_ => GlobalVariables.preferencesRx.camera_overview.Value = !GlobalVariables.preferencesRx.camera_overview.Value)
        .AddTo(overviewToggle);

        GlobalVariables.levelPrefsRx.width.SubscribeToText(widthInput.textComponent).AddTo(widthInput.textComponent);
        GlobalVariables.levelPrefsRx.height.SubscribeToText(heightInput.textComponent).AddTo(heightInput.textComponent);

        widthInput.OnEndEditAsObservable().Subscribe(x => GlobalVariables.levelPrefsRx.width.Value   = int.Parse(x)).AddTo(widthInput);
        heightInput.OnEndEditAsObservable().Subscribe(x => GlobalVariables.levelPrefsRx.height.Value = int.Parse(x)).AddTo(widthInput);
    }