Inheritance: MonoBehaviour
Example #1
0
        public override void Update(GameTime gameTime)
        {
            if (showIntro && Manager.UIInput.Hit("jump"))
            {
                if (!showGameInput)
                {
                    GameInputMap controls = new GameInputMap();
                    Manager.Scene.AddEntity(controls);
                    controls.DisableBackground = true;
                    controls.DisableHint       = true;

                    intro1.Visible = false;
                    intro2.Visible = false;
                    intro3.Visible = false;

                    showGameInput = true;
                }
                else
                {
                    Manager.Vars["currentLevel"] = 1;
                    Manager.Vars["CMYK_Ammo"]    = 0;
                    Manager.Vars["score"]        = 0;
                    ResetLevel reset = new ResetLevel();
                    Manager.Scene.AddEntity(reset);
                    reset.Inmediate = true;
                }
            }
        }
Example #2
0
        public override void Update(GameTime gameTime)
        {
            // Obtenemos la instancia del componente del jugador:
            Player p = (Player)Manager.Scene.FindByName("player");

            if (!Manager.UIInput.IsConnected || Guide.IsVisible)
            {
                Manager.Vars["showMessagePause"] = true;
            }

            // Si el jugador esta vivo y se ha activado la pausa se muestra el dialogo correspondiente:
            if (!p.IsDead && (bool)Manager.Vars["showMessagePause"] == true)
            {
                Manager.PhysicEngine.Enabled = false;
                if (Manager.Scene.FindByName("msgBox") == null)
                {
                    Manager.Scene.AddEntity(new Entities.GUI.PauseMenu(), "msgBox");
                }
            }
            else
            {
                Manager.PhysicEngine.Enabled = true;
            }

            if ((bool)Manager.Vars["exitLevel"])
            {
                ResetLevel reset = new ResetLevel();
                Manager.Scene.AddEntity(reset);
                reset.Inmediate = true;

                Manager.Vars["exitLevel"] = false;
            }
        }
Example #3
0
 void Awake()
 {
     if (instance == null) {
         instance = this;
     } else if (instance != this) {
         Destroy (gameObject);
     }
 }
Example #4
0
        public void OnResetEvent()
        {
            ResetLevel reset = new ResetLevel();

            Manager.Scene.AddEntity(reset);
            reset.Inmediate = true;
            Kill();
        }
Example #5
0
 // Reset the delegates related to non-permanent entities
 public void ResetManager()
 {
     RotateBeaconCall    = null;
     ChooseDirectionCall = null;
     ChangeBeaconCall    = null;
     PickupCall          = null;
     SelectionCall       = null;
     ResetCall           = null;
 }
Example #6
0
 void Start()
 {
     camControler  = GameObject.FindGameObjectWithTag("CameraController").GetComponent <CameraControler>();
     timeMaster    = GameObject.FindGameObjectWithTag("TimeMaster").GetComponent <TimeMaster>();
     cpMaster      = GameObject.FindGameObjectWithTag("cpMaster").GetComponent <CheckpointMaster>();
     resetLevel    = GameObject.FindGameObjectWithTag("LevelReset").GetComponent <ResetLevel>();
     levelBlockade = GameObject.FindGameObjectWithTag("LevelBlockade");
     levelBlockade.SetActive(false);
 }
Example #7
0
        private bool Reset(ResetLevel level)
        {
            bool        result      = false;
            string      json        = "{ \"parameters\":{ \"level\":\"" + level.ToString() + "\"} }";
            APIResponse apiresponse = _connect.Get("/system/reset", Connect.Method.POST, json);

            if (apiresponse.StatusCode == 204)
            {
                result = true;
            }
            else
            {
                ErrorEvent(this, new EventArgs());
            }

            return(result);
        }
Example #8
0
    void Start()
    {
        cObj = GetComponent <CharacterController2D>();
        rObj = GameObject.Find("God").GetComponent <ResetLevel>();
        anim = GetComponent <Animator>();
        sObj = GetComponent <Score>();
        hObj = GetComponent <Health>();
        tObj = GetComponent <Timer>();
        if (SceneManager.GetActiveScene().name == "Level1" && !(PlayerPrefs.GetInt("Level Reached") > 1))
        {
            PlayerPrefs.SetInt("Level Reached", 1);
        }
        else if (SceneManager.GetActiveScene().name == "Level2" && !(PlayerPrefs.GetInt("Level Reached") > 2))
        {
            PlayerPrefs.SetInt("Level Reached", 2);
        }
        else if (SceneManager.GetActiveScene().name == "Level3" && !(PlayerPrefs.GetInt("Level Reached") > 3))
        {
            PlayerPrefs.SetInt("Level Reached", 3);
        }
        else if (SceneManager.GetActiveScene().name == "Level4" && !(PlayerPrefs.GetInt("Level Reached") > 4))
        {
            PlayerPrefs.SetInt("Level Reached", 4);
        }
        else if (SceneManager.GetActiveScene().name == "Level5")
        {
            PlayerPrefs.SetInt("Level Reached", 5);
        }
        if (SceneManager.GetActiveScene().name == "Level5")
        {
            wObj = GetComponent <Wind>();
        }
        lObj = GameObject.Find("Chest").GetComponent <NextLevel>();

        sr = GetComponent <SpriteRenderer>();

        srOrigColor = sr.color;

        sprites        = GetComponentsInChildren <SpriteRenderer>();
        deathText.text = PlayerPrefs.GetInt("Player Deaths").ToString();

        /*for (int i=0; i < spriteRenderers.Count; ++i) {
         *  colors.Add(spriteRenderers.material.color);
         *  renderer.material.color = new Color(1,1,1,0.5f);
         * }*/
    }
Example #9
0
        public void OnEnterLevel(GridButtonGroup group)
        {
            if (group.Selected.Level == 1)
            {
                Manager.GameStates.ChangeState("intro");
            }
            else
            {
                Session.GameProgress = StorageSession.LoadData <GameDefinitions.SaveGame>(Session.SaveGameFilename);

                Manager.Vars["currentLevel"] = group.Selected.Level;
                Manager.Vars["CMYK_Ammo"]    = Session.GameProgress.CurrentCMYKAmmo;
                Manager.Vars["score"]        = Session.GameProgress.CurrentScore;
                ResetLevel reset = new ResetLevel();
                Manager.Scene.AddEntity(reset);
                reset.Inmediate = true;
            }
        }
Example #10
0
    void Start()
    {
        rb2d             = gameObject.GetComponent <Rigidbody2D>();
        rb2d.isKinematic = false;

        anim = gameObject.GetComponent <Animator>();

        if (GameObject.FindGameObjectWithTag("cpMaster") != null)
        {
            checkpointMaster = GameObject.FindGameObjectWithTag("cpMaster").GetComponent <CheckpointMaster>();
        }

        if (GameObject.FindGameObjectWithTag("DeathBed") != null)
        {
            deadlyObjects = GameObject.FindGameObjectWithTag("DeathBed").GetComponent <KillPlayer>();
        }

        if (GameObject.FindGameObjectWithTag("CameraShaker") != null)
        {
            cameraShaker = GameObject.FindGameObjectWithTag("CameraShaker").GetComponent <Shake>();
        }

        if (GameObject.FindGameObjectWithTag("TimeMaster") != null)
        {
            timeMaster = GameObject.FindGameObjectWithTag("TimeMaster").GetComponent <TimeMaster>();
        }

        if (GameObject.FindGameObjectWithTag("LevelReset") != null)
        {
            resetLevel = GameObject.FindGameObjectWithTag("LevelReset").GetComponent <ResetLevel>();
        }

        if (GameObject.FindGameObjectWithTag("GameOverScreen") != null)
        {
            gameOverScreen = GameObject.FindGameObjectWithTag("GameOverScreen");
            gameOverScreen.SetActive(false);
        }

        dash = gameObject.GetComponent <Dash>();
    }
Example #11
0
 public ResetCommand(string command, ResetLevel level)
 {
     _command = command;
     _level = level;
 }
Example #12
0
        private void PerformReset(ResetLevel level)
        {
            using (var cn = new SqlConnection(ConfigItems.ConnectionString)) {
                cn.Open();
                var trans = cn.BeginTransaction("CleanTransaction");

                try
                {
                    foreach (var delete in GetDeleteCommands(level))
                    {
                        var cmd = delete.Command;
                        cmd.Connection = cn;
                        cmd.Transaction = trans;

                        cmd.ExecuteNonQuery();
                    }

                    // reset the system settings
                    foreach (var setting in GetSystemSettingCommands(level))
                    {
                        var cmd = setting.Command;
                        cmd.Connection = cn;
                        cmd.Transaction = trans;

                        cmd.ExecuteNonQuery();
                    }

                    trans.Commit();
                }
                catch (Exception ex)
                {
                    try
                    {
                        trans.Rollback();
                    }
                    catch { }
                    throw ex;
                }
            }

            NumberOfCalls = GetNumberOfCallDataRows();
            Info.SetSuccess("Database has been Reset : " + Enum<ResetLevel>.GetDescription(level) + " cleared");
        }
Example #13
0
        private static List<ResetCommand> GetSystemSettingCommands(ResetLevel level)
        {
            if (SystemSettingCommands == null) {
                SystemSettingCommands = new List<ResetCommand>
                                            {
                                                new ResetCommand(
                                                    "UPDATE SystemSettings SET KeyValue='1' WHERE SystemSettingId=1",
                                                    ResetLevel.Invoicing),
                                                new ResetCommand(
                                                    "UPDATE SystemSettings SET KeyValue='1' WHERE SystemSettingId=2"),
                                                new ResetCommand(
                                                    "UPDATE SystemSettings SET KeyValue='1' WHERE SystemSettingId=3"),
                                                new ResetCommand(
                                                    "UPDATE SystemSettings SET KeyValue='2001-01-01' WHERE SystemSettingId=4",
                                                    ResetLevel.Invoicing),
                                                new ResetCommand(
                                                    "UPDATE SystemSettings SET KeyValue='1' WHERE SystemSettingId=5",
                                                    ResetLevel.Invoicing),
                                            };
            }

            if (level == ResetLevel.All)
                return SystemSettingCommands;

            return SystemSettingCommands.FindAll(cmd => cmd.Level <= level);
        }
Example #14
0
        private static List<ResetCommand> GetDeleteCommands(ResetLevel level)
        {
            if (DeleteCommands == null) {

                // Order is important. Must allow for referential integrity.  No Deletes are cascading.
                DeleteCommands = new List<ResetCommand>
                                     {
                                         new ResetCommand("DELETE FROM [Log]", ResetLevel.Invoicing),
                                         new ResetCommand("DELETE FROM AccountInvoice", ResetLevel.Invoicing),
                                         new ResetCommand("DELETE FROM InvoiceLineItem", ResetLevel.Invoicing),
                                         new ResetCommand("DELETE FROM InvoiceHeader", ResetLevel.Invoicing),
                                         new ResetCommand("UPDATE Call SET DateInvoiced = NULL", ResetLevel.Invoicing),
                                         new ResetCommand("UPDATE Account SET AmountPaid = 0, PreviousBill = 0", ResetLevel.Invoicing),
                                         new ResetCommand("DELETE FROM Call", ResetLevel.InvoicingAndCalls),
                                         new ResetCommand("DELETE FROM ContractPlanVariance", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM Contract", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM Agent", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM Account", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM Contact", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM ActivityLog", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM Audit", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM VizadaData", ResetLevel.InvoicingAndCalls),
                                         new ResetCommand("DELETE FROM SatComData", ResetLevel.InvoicingAndCalls),
                                         new ResetCommand("DELETE FROM Company", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM ContractCustomFee", ResetLevel.ContractsAndCustomers),
                                         new ResetCommand("DELETE FROM NetworkTariff"),
                                         new ResetCommand("DELETE FROM Network"),
                                         new ResetCommand("DELETE FROM Tariff"),
                                         new ResetCommand("DELETE FROM [Plan]"),
                                         new ResetCommand("DELETE FROM CustomFee"),
                                     };

            }

            if (level == ResetLevel.All)
                return DeleteCommands;

            return DeleteCommands.FindAll(cmd => cmd.Level <= level);
        }
Example #15
0
    void Update()
    {
        player.GetComponent<Rigidbody>().isKinematic = false;
        if ( Input.GetMouseButtonUp( 0 ) )
        {
            resource = CheckForResource();
            reset = CheckForReset();
            if (resource != null)
            {//Debug.Log("Click on Resource");

                string tag = resource.transform.gameObject.tag;
                if (tag == "Resource")
                {
                    resource.Collect(resource.transform.gameObject);
                    setResourceCountText();
                }

            }
            if (reset != null)
            {Debug.Log("Clicked on Reset");
                resetObject = reset.transform.gameObject;
                resetReference = reset;
                Invoke("destroyMapDelay", 3f);
            }
        }

        if (Input.GetKey(KeyCode.Escape))
        {
            Debug.Log("Quiting");
            Application.Quit();
        }

        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            Debug.Log("Pressed Enter");
            paused = !paused;
            if (paused == true)
            {
                Debug.Log("Pausing");
                pauseText.text = "PAUSED";
                Time.timeScale = 0;
            }
            else if (paused == false)
            {
                Debug.Log("The enter button isn't pressed");
                pauseText.text = "";
                Time.timeScale = 1;
            }
        }
    }
Example #16
0
 void Awake()
 {
     this.resetScript = GetComponent<ResetLevel>();
     this.resetting = false;
     this.currentResetTime = 0f;
     SetLoopTime();
     FindPlayersInScene();
     currentPlayer = redPlayer;
     this.FindThingsToReset();
 }