// Update is called once per frame
    void Update()
    {
        transform.rotation = Quaternion.identity;

        if (click)
        {
            tiempoAntesDeDestruir -= Time.deltaTime;

            if (!clickeada)
            {
                GMScript.SumarMonedas(ValorMoneda);
                clickeada = true;
            }

            if (tiempoAntesDeDestruir <= 0)
            {
                Destroy(gameObject);
            }
        }
        if (TiempoParaDesaparecer <= 0 && !Desapareciendo)
        {
            elAnimator.Play("AnimacionDesaparecer");
            Desapareciendo = true;
        }
        else
        {
            TiempoParaDesaparecer -= Time.deltaTime;
        }
    }
Exemple #2
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.name == "zooball")
        {
            Debug.Log("Hit Wall");

            GMScript theScript = timer.GetComponent <GMScript> ();
            float    theTime   = theScript.getTime();

            script.enabled1 = false;

            GetComponent <AudioSource>().Play();

            if (PlayerPrefs.GetFloat("highScore") < theTime)
            {
                PlayerPrefs.SetFloat("highScore", theTime);
            }
            //GameOverScreen
            //Application.LoadLevel(Application.loadedLevel);



            //	transform.gameObject.AddComponent<GameOverScript> ();
            GameObject go  = Instantiate(Resources.Load("Textures/Screen/gameOverTextPref")) as GameObject;
            GameObject go2 = Instantiate(Resources.Load("Textures/Screen/playAgainTextPref")) as GameObject;
            GameObject go3 = Instantiate(Resources.Load("Textures/Screen/highScorePref")) as GameObject;
            Time.timeScale = 0;


            GameObject.Destroy(GameObject.Find("UITimer"));
            GameObject.Destroy(GameObject.Find("UITimer2"));
            GameObject.Destroy(GameObject.Find("UITimer3"));
        }
    }
Exemple #3
0
        public static void Script(ProjectWriter writer, GMScript self, GMProject _)
        {
            writer.Write(self.Name);
            writer.Write(self.Version);

            writer.Write(self.Code);
        }
Exemple #4
0
 void Start()
 {
     body             = GetComponent <Rigidbody2D>();
     body.isKinematic = false;
     body.AddForce(new Vector2(initialForceX, initialForceY));
     gm      = GameObject.FindWithTag("Player").GetComponent <GMScript>();
     rageBar = gm.GetComponent <UIRageBarScript>();
 }
Exemple #5
0
 void Start ()
 {
     body = GetComponent<Rigidbody2D>();
     body.isKinematic = false;
     body.AddForce(new Vector2(initialForceX, initialForceY));
     gm = GameObject.FindWithTag("Player").GetComponent<GMScript>();
     rageBar = gm.GetComponent<UIRageBarScript>();
 }
 // Use this for initialization
 void Start()
 {
     selectedCard    = 1;
     currSymbolToUse = 0;
     myTCont         = GameObject.Find("GameManager").GetComponent <TurnController>();
     myGM            = GameObject.Find("GameManager").GetComponent <GMScript>();
     hiddenCardsPos  = transform.position;
     amHidden        = true;
     cardsChosen     = false;
 }
Exemple #7
0
    void Start()
    {
        s_instance = this;

        if (PlayerScript.s_instance)
        {
            input_speed.text  = PlayerScript.s_instance.runSpeed.ToString();
            input_damage.text = PlayerScript.s_instance.damage.ToString();
        }
    }
Exemple #8
0
    public void TakeText()
    {
        string maxCoat  = GMScript.ShowValues("maxCoat").ToString();
        string plusGold = GMScript.ShowValues("plusGold").ToString();

        coalValueText.text = maxCoat;
        goldValueText.text = plusGold;
        plusGoldText.text  = plusGold;

        ShowPanel();
    }
Exemple #9
0
    public void CollectButton()
    {
        int maxcoat = GMScript.ShowValues("maxCoat");

        GMScript.ChangeValues("coatMinus", maxcoat);

        int plusGold = GMScript.ShowValues("plusGold");

        GMScript.ChangeValues("gold", plusGold);

        HidePanel();
    }
 private void Awake()
 {
     if (instance == null || instance == this)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this);
     Debug.Log("Scene reloaded");
 }
Exemple #11
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        SetUp();
    }
Exemple #12
0
    private void RestoreGold()
    {
        Debug.Log(currentTarget);
        if (GMScript != null)
        {
            if (currentTarget != null)
            {
                currentTarget.GetComponent <AdComponentAsteroid>().HidePanel();
            }

            int maxVal = GMScript.ShowValues("maxGold");
            GMScript.ChangeValues("gold", maxVal);
        }
    }
Exemple #13
0
	// Use this for initialization
	void Start () {
		playerScore01 = 0;
		playerScore02 = 0;
		goalPlayer1 = false;
		goalPlayer2 = false;
		
		playersT1 = GameObject.FindGameObjectsWithTag ("Team1");
		playersT2 = GameObject.FindGameObjectsWithTag ("Team2");
		ball = GameObject.FindGameObjectWithTag("Ball");

		currentGame = this;

		StartCoroutine(stopThings());	
	}
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        playerScore01 = 0;
        playerScore02 = 0;
        goalPlayer1   = false;
        goalPlayer2   = false;

        playersT1 = GameObject.FindGameObjectsWithTag("Team1");
        playersT2 = GameObject.FindGameObjectsWithTag("Team2");
        ball      = GameObject.FindGameObjectWithTag("Ball");

        currentGame = this;

        StartCoroutine(stopThings());
    }
Exemple #15
0
    void OnMouseDown()
    {
        FindObjectOfType <CameraFollow>().isFollowing = true;
        logan_player_controller player = FindObjectOfType <logan_player_controller>();

        player.rb.bodyType             = RigidbodyType2D.Dynamic;
        GlobalSceneChange.locationFrom = loadingName;

        //GMScript.write_farm_to_file("farmtmp.txt",GMScript.farm,GMScript.numberOfPlotsWidth,GMScript.numberOfPlotsHeight);
        GMScript.write_farm_to_farm_data(GMScript.farm, GMScript.numberOfPlotsWidth, GMScript.numberOfPlotsHeight);

        GlobalSceneChange.sceneFrom = SceneManager.GetActiveScene().name;
        GMScript.healthUi.SetActive(true);

        SceneManager.LoadScene(sceneTo);
    }
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.tag == "Corte")
     {
         if (EntroCorte)
         {
             EntroCorte                = false;
             GMScript.CorteNro        += 1;
             GMScript.CorteMonedasNro += 1;
             if (GMScript.JuegoInicio)
             {
                 GMScript.SumaPuntos(PuntajeCorte[GMScript.elNivel]);
                 FuerzaCorte = FuerzaConMetal;
             }
         }
     }
 }
Exemple #17
0
    private void ChangeButt()
    {
        Debug.Log(currentTarget);
        if (GMScript != null)
        {
            if (currentTarget != null)
            {
                currentTarget.GetComponent <AdComponent>().HidePanel();
            }

            int maxVal = GMScript.ShowValues("maxCoat");
            GMScript.ChangeValues("coatMinus", maxVal);

            int plusGold = GMScript.ShowValues("plusGold");
            GMScript.ChangeValues("gold", plusGold * 2);
        }
    }
Exemple #18
0
    // Start is called before the first frame update
    void Start()
    {
        List <string> deck = GMScript.CreateDeck();

        gm = FindObjectOfType <GMScript>();
        int i;

        foreach (string card in deck)
        {
            if (this.name == card)
            {
                i = deck.IndexOf(card);

                Cardfaces = gm.Deadwood[i];

                break;
            }
        }
        Sprender        = GetComponent <SpriteRenderer>();
        Sprender.sprite = Cardfaces;
    }
Exemple #19
0
    // Start is called before the first frame update
    void Start()
    {
        List <string> deck = GMScript.CreateDeck();

        gm  = FindObjectOfType <GMScript>();
        SSC = FindObjectOfType <SortingAndSetCreating>();
        SOG = FindObjectOfType <MyGameStates>();
        ET  = FindObjectOfType <EnemyTest>();
        int i = 0;

        foreach (string card in deck)
        {
            if (this.name == card)
            {
                Cardfaces = gm.Cards[i];

                break;
            }
            i++;
        }
        Sprender   = GetComponent <SpriteRenderer>();
        selectable = GetComponent <selectable>();
    }
Exemple #20
0
	public void SpringCollision (GMScript.Springer sprop)
	{	//called when player collides with spring from spring script
			//springs launch you pretty hard
			//rigidbody2D.velocity = new Vector2 (rigidbody2D.velocity.x, JUMPSPEED * sprop.intensity);
		transform.position = sprop.elRay.origin; //move to center of spring so that you can hit it from any side and get the same effect
		float mag = JUMPSPEED * sprop.intensity; //combine ray's direction with player speed default. differentiate between spring and big spring with intensity
		float dirx = sprop.elRay.direction.x;
		float diry = sprop.elRay.direction.y;
		if (Mathf.Abs(dirx) != Mathf.Abs(diry)){
			rigidbody2D.velocity = new Vector2 (dirx * MAXSPEED, diry * mag);
		}
		else { //want the 45 degree angle spring to have more horizontal power
			rigidbody2D.velocity = new Vector2(Mathf.Sign(dirx) * MAXSPEED, diry * mag);
		}	
			UnGroundSelf();
		if (!GMScript.state.Equals(GMScript.Context.dead))
		{
			GMScript.state = GMScript.Context.normal; //just in case you zipline into the teleporter, don't want to be stuck in that state
		}
	}
Exemple #21
0
 // Use this for initialization
 void Start()
 {
     speed    = 5f;
     player   = GameObject.Find("Player");
     gmScript = GameObject.Find("GM").GetComponent <GMScript> ();
 }
Exemple #22
0
	// Use this for initialization
	void Start () {
        gm = GameObject.FindWithTag("Player").GetComponent<GMScript>();
        GetComponent<Text>().text = CollectedCombs.ToString();
    }
Exemple #23
0
 // Use this for initialization
 void Start()
 {
     sr        = GetComponent <SpriteRenderer>();
     sr.sprite = fullComb;
     gm        = GameObject.FindWithTag("Player").GetComponent <GMScript>();
 }
Exemple #24
0
 // Use this for initialization
 void Start()
 {
     gm = GameObject.FindWithTag("Player").GetComponent <GMScript>();
     GetComponent <Text>().text = CollectedCombs.ToString();
 }
 // Start is called before the first frame update
 void Start()
 {
     gm          = FindObjectOfType <GMScript>();
     PlayerScore = gm.PScore;
     CGroup();
 }
 // Use this for initialization
 void Awake()
 {
     speed    = 5f;
     gmScript = GameObject.Find("GM").GetComponent <GMScript> ();
 }
Exemple #27
0
 void Start()
 {
     gm  = FindObjectOfType <GMScript>();
     SOG = FindObjectOfType <MyGameStates>();
 }
Exemple #28
0
        /// <summary>
        /// Reads a Game Maker project file
        /// </summary>
        public void ReadProject(string file)
        {
            // If the file does not exist, throw exception
            if (File.Exists(file) == false)
            {
                throw new Exception("The Game Maker project file does not exist.");
            }

            // Get file extension
            string ext = file.Substring(file.LastIndexOf('.')).ToLower();

            // If a GMS project file
            if (ext == ".gmx")
            {
                // Read in the project as a Game Maker Studio project and return
                ReadProjectGMS(file);
                return;
            }

            // Get file size
            FileInfo info   = new FileInfo(file);
            long     length = info.Length;

            // Create a new GM file reader
            using (GMFileReader reader = new GMFileReader(new FileStream(file, FileMode.Open, FileAccess.Read)))
            {
                // Progress event
                ProgressChanged("Starting project read...", reader.BaseStream.Position, length);

                // Read the magic number
                int id = reader.ReadGMInt();

                // If the magic number was incorrect, not a Game Maker project file
                if (id != 1234321)
                {
                    throw new Exception("Not a valid Game Maker project file.");
                }

                // Get Game Maker project file version
                int version = reader.ReadGMInt();

                // Check version
                switch (version)
                {
                case 500: this.GameMakerVersion = GMVersionType.GameMaker50; break;

                case 510: this.GameMakerVersion = GMVersionType.GameMaker51; break;

                case 520: this.GameMakerVersion = GMVersionType.GameMaker52; break;

                case 530: this.GameMakerVersion = GMVersionType.GameMaker53; break;

                case 600: this.GameMakerVersion = GMVersionType.GameMaker60; break;

                case 701: this.GameMakerVersion = GMVersionType.GameMaker70; break;

                case 800: this.GameMakerVersion = GMVersionType.GameMaker80; break;

                case 810: this.GameMakerVersion = GMVersionType.GameMaker81; break;
                }

                // Skip over reserved bytes
                if (version < 600)
                {
                    reader.ReadGMBytes(4);
                }

                // Game Maker 7 project file encryption
                if (version == 701)
                {
                    // Bill and Fred, psssttt they like each other ;)
                    int bill = reader.ReadGMInt();
                    int fred = reader.ReadGMInt();

                    // Skip bytes to treasure.
                    reader.ReadGMBytes(bill * 4);

                    // Get the seed for swap table
                    int seed = reader.ReadGMInt();

                    // Skip bytes to get out of the junk yard
                    reader.ReadGMBytes(fred * 4);

                    // Read first byte of Game id (Not encrypted)
                    byte b = reader.ReadByte();

                    // Set the seed
                    reader.SetSeed(seed);

                    // Read game id
                    id = reader.ReadGMInt(b);
                }
                else  // Read game id normally
                {
                    id = reader.ReadGMInt();
                }

                // Skip unknown bytes
                reader.ReadGMBytes(16);

                // Read settings
                ProgressChanged("Reading Settings...", reader.BaseStream.Position, length);

                // Read main project objects
                this.Settings = GMSettings.ReadSettings(reader);
                this.Settings.GameIdentifier = id;

                // If the version is greater than Game Maker 7.0
                if (version > 701)
                {
                    // Read triggers and constants.
                    this.Triggers           = GMTrigger.ReadTriggers(reader);
                    this.Settings.Constants = GMConstant.ReadConstants(reader);
                }

                // Read sounds
                ProgressChanged("Reading Sounds...", reader.BaseStream.Position, length);
                this.Sounds = GMSound.ReadSounds(reader);

                // Read sprites
                ProgressChanged("Reading Sprites...", reader.BaseStream.Position, length);
                this.Sprites = GMSprite.ReadSprites(reader);

                // Read backgrounds
                ProgressChanged("Reading Backgrounds...", reader.BaseStream.Position, length);
                this.Backgrounds = GMBackground.ReadBackgrounds(reader);

                // Read paths
                ProgressChanged("Reading Paths...", reader.BaseStream.Position, length);
                this.Paths = GMPath.ReadPaths(reader);

                // Read scripts
                ProgressChanged("Reading Scripts...", reader.BaseStream.Position, length);
                this.Scripts = GMScript.ReadScripts(reader);

                // Get version
                int version2 = reader.ReadGMInt();

                // Check version
                if (version2 != 440 && version2 != 540 && version2 != 800)
                {
                    throw new Exception("Unsupported Pre-Font/Pre-Data File object version.");
                }

                // If version is old, read data files else, read fonts.
                if (version2 == 440)
                {
                    // Read data files
                    ProgressChanged("Reading Data Files...", reader.BaseStream.Position, length);
                    this.DataFiles = GMDataFile.ReadDataFiles(reader);
                }
                else
                {
                    // Read fonts
                    ProgressChanged("Reading Fonts...", reader.BaseStream.Position, length);
                    this.Fonts = GMFont.ReadFonts(version2, reader);
                }

                // Read timelines
                ProgressChanged("Reading Timelines...", reader.BaseStream.Position, length);
                this.Timelines = GMTimeline.ReadTimelines(reader);

                // Read objects
                ProgressChanged("Reading Objects...", reader.BaseStream.Position, length);
                this.Objects = GMObject.ReadObjects(reader);

                // Read rooms
                ProgressChanged("Reading Rooms...", reader.BaseStream.Position, length);
                this.Rooms = GMRoom.ReadRooms(this.Objects, reader);

                // Read last ids for instances and tiles
                this.LastInstanceId = reader.ReadGMInt();
                this.LastTileId     = reader.ReadGMInt();

                // If the version is above 6.1, read include files and packages
                if (version >= 700)
                {
                    // Read includes
                    ProgressChanged("Reading Includes...", reader.BaseStream.Position, length);
                    this.Settings.Includes = GMInclude.ReadIncludes(reader);

                    // Read packages
                    ProgressChanged("Reading Packages...", reader.BaseStream.Position, length);
                    this.Packages.AddRange(GMPackage.ReadPackages(reader));
                }

                // Read game information
                ProgressChanged("Reading Game Information...", reader.BaseStream.Position, length);
                this.GameInformation = GMGameInformation.ReadGameInformation(reader);

                // Get version
                version = reader.ReadGMInt();

                // Check version
                if (version != 500)
                {
                    throw new Exception("Unsupported Post-Game Information object version.");
                }

                // Read libraries
                ProgressChanged("Reading Libraries...", reader.BaseStream.Position, length);
                this.Libraries = GMLibrary.ReadLibraries(reader);

                // Read project tree
                ProgressChanged("Reading Project Tree...", reader.BaseStream.Position, length);
                this.ProjectTree = GMNode.ReadTree(file.Substring(file.LastIndexOf(@"\") + 1), reader);

                // Progress event
                ProgressChanged("Finished Reading Project.", reader.BaseStream.Position, length);
            }
        }
    void Start()
    {
        sunText = GameObject.Find ("Sun").GetComponent<sunScript> ();
                rb2D = GetComponent<Rigidbody2D> ();
                scrHeight = Screen.height;
                tr = GetComponent<Transform> ();
                canCollect = true;
                players = GameObject.FindGameObjectsWithTag ("Player");
                heaven = GameObject.Find ("Heaven");
                startingHeight = transform.position.y;
                startingGravity = rigidbody2D.gravityScale;
                canLift = true;
                audio = GetComponents<AudioSource> ();
                animator = GetComponent<Animator> ();

                g = GameObject.Find ("GameManager");
                if (g) {
                        gm = g.GetComponent<GMScript> ();
                        winningScore = gm.winningScore;
                }
    }
Exemple #30
0
	// Use this for initialization
	void Start () {
        sr = GetComponent<SpriteRenderer>();
        sr.sprite = fullComb;
        gm = GameObject.FindWithTag("Player").GetComponent<GMScript>();
    }
Exemple #31
0
        /// <summary>
        /// Reads scripts from GM file
        /// </summary>
        private GMList<GMScript> ReadScripts()
        {
            // Get version.
            int version = ReadInt();

            // Check version.
            if (version != 400 && version != 800)
                throw new Exception("Unsupported Pre-Script object version.");

            // Create a new list of scripts.
            GMList<GMScript> scripts = new GMList<GMScript>();

            // Amount of script ids.
            int num = ReadInt();

            // Iterate through scripts.
            for (int i = 0; i < num; i++)
            {
                // If version is 8.0, start inflate.
                if (version == 800)
                    Decompress();

                // If the script at index does not exists, continue.
                if (ReadBool() == false)
                {
                    scripts.LastId++;
                    EndDecompress();
                    continue;
                }

                // Create a new script object.
                GMScript script = new GMScript();

                // Set script id.
                script.Id = i;

                // Read script data.
                script.Name = ReadString();

                // If version is 8.0, get last changed.
                if (version == 800)
                    script.LastChanged = ReadDouble();

                // Get version.
                version = ReadInt();

                // Check version.
                if (version != 400 && version != 800)
                    throw new Exception("Unsupported Script object version.");

                // Read script data.
                script.Code = ReadString();

                // End object inflate.
                EndDecompress();

                // Add script.
                scripts.Add(script);
            }

            // Return scripts.
            return scripts;
        }
 void Start()
 {
     GM = GameObject.Find("GameManager").GetComponent <GMScript>();
     AC = GameObject.Find("APlayer(Clone)").GetComponent <AlienController>();
 }