예제 #1
0
    GameObject GenerateNextBlock(int index, GameObject currentBlock)
    {
        GameBlock     block    = MessageSystemGameBlock.ReturnDisactiveGameObject(index);
        GameObject    newBlock = block.GetGameObject();
        BoxCollider2D curBox   = currentBlock.GetComponent <BoxCollider2D>();
        float         offset   = 0;

        if (newBlock.name == "Barrier_Grey" || newBlock.name == "Portal_Grey")
        {
            Storage.CountTripleBlock = 3;
        }
        if (block.Extents != -1)
        {
            offset = curBox.bounds.extents.x + block.Extents;
        }
        else
        {
            GenerateNextEarth(currentBlock);
            Storage.CountBlockEarth++;
        }
        newBlock.transform.position = new Vector3(curBox.bounds.center.x + offset, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, false);
        block.SetActiveFull(true);
        if (Storage.CountTripleBlock != 0)
        {
            Storage.CountTripleBlock--;
        }
        return(newBlock);
    }
 public static void StartGame()
 {
     isStart = true;
     MessageSystemGameBlock.Speed           = speed;
     MessageSystemGameBlock.BackgroundSpeed = backgroundSpeed;
     player.SetActive(false);
     ChangeHeroAfterStart();
     OpenMenu.NumberOperation = 2;
     player.SetActive(true);
     MessageSystemGameBlock.StartStopWatch();
     Generate.Level = MessageSystemGameBlock.LEVEL;
     if (listAudio.Count != 0)
     {
         if (Conecting.Music == 1)
         {
             SaveListAudio();
             playMusic();
         }
     }
     else
     {
         StopClip();
     }
     MusicButton.DisableMusicButton();
 }
예제 #3
0
 private void OnMouseUp()
 {
     anim.Play("GoAway");
     if (!MessageSystemPlayingScene.IsStart)
     {
         menuPanel.SetActive(false);
         MessageSystemPlayingScene.StartGame();
         if (Conecting.Management == 0)
         {
             screen.SetActive(true);
         }
         else
         {
             StartCoroutine(EnButtons());
         }
         MessageSystemGameBlock.DisableAllBlock();
         Score.increeze();
     }
     else
     {
         MessageSystemGameBlock.StartAfterHit();
         MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
         EnableButtons();
     }
     if (PlayerPrefs.HasKey("FirstStart"))
     {
         PauseGame.IsPause = false;
         pause.SetActive(true);
     }
     else
     {
         FirstStart.SetActiveStopCollider(true);
     }
     source.Play();
 }
예제 #4
0
    void GenerateNextBlock(GameObject currentBlock, out GameObject returnBlock)
    {
        int i              = groupBlock[numberGroup].Length - countRemainingBlock;
        int blockValue     = groupBlock[numberGroup][i];
        int indexNextBlock = blockValue / 100;

        Storage.CountBlockEarth = blockValue % 10;
        int       index = (blockValue / 10) % 10;
        GameBlock block = MessageSystemGameBlock.ReturnBlockFromGroup(indexNextBlock, index);

        GameObject    newBlock = block.GetGameObject();
        BoxCollider2D curBox   = currentBlock.GetComponent <BoxCollider2D>();
        float         offset   = 0;

        if (block.Extents != -1)
        {
            offset = curBox.bounds.extents.x + block.Extents;
        }
        else
        {
            GenerateNextEarth(currentBlock);
            Storage.CountBlockEarth++;
        }
        newBlock.transform.position = new Vector3(curBox.bounds.center.x + offset, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, false);
        block.SetActiveFull(true);
        returnBlock = newBlock;
    }
예제 #5
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        GameObject obj = collision.gameObject;

        if (PlayerZone.IsOutside && !MessageSystemPlayingScene.Player.CompareTag("InVisible") && !MessageSystemPlayingScene.IsDead)
        {
            PlayerZone.MoveToPlayerZone();
        }
        if ((obj.CompareTag("Player") || (obj.CompareTag("Hit") && obj.name == "Brian")) && MessageSystemPlayingScene.IsJump)
        {
            MessageSystemPlayingScene.exitFromPingPong = false;
            if (!PlayerZone.IsOutside)
            {
                MessageSystemPlayingScene.SetDefaultConstraints();
            }
            else
            {
                MessageSystemGameBlock.SetPlayingConstraints();
            }
            if (Conecting.Management == 0 && !TapToGo.Screen.activeInHierarchy)
            {
                TapToGo.Screen.SetActive(true);
            }
            MessageSystemPlayingScene.IsJump = false;
            MessageSystemPlayingScene.Player.GetComponent <Animator>().SetBool("IsRunAgain", true);
            StartCoroutine(PreparationToJump());
        }
    }
예제 #6
0
 public static void DeathAfterDeadLine()
 {
     MessageSystemPlayingScene.GeneralyPartOfDeath();
     MessageSystemPlayingScene.AutoSelectNextCharacter();
     MessageSystemGameBlock.StartGame();
     MessageSystemPlayingScene.InBodyColider = false;
 }
예제 #7
0
 public override GameObject Generate(GameObject currentBlock)
 {
     newBlock.transform.position = new Vector3(currentBlock.transform.position.x + Earth.Delta, newBlock.transform.position.y, newBlock.transform.position.z);
     MessageSystemGameBlock.SetupParent(newBlock, false);
     newBlock.SetActive(true);
     return(newBlock);
 }
예제 #8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && !MessageSystemPlayingScene.inPingPong)
     {
         MessageSystemPlayingScene.InBodyColider = true;
         MessageSystemGameBlock.SetPlayingConstraints();
     }
 }
예제 #9
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        GameObject currentBlock = collision.gameObject;

        newBlock.transform.position = new Vector3(currentBlock.transform.position.x + Earth.Delta, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, true);
        newBlock.SetActive(true);
    }
예제 #10
0
파일: Hint.cs 프로젝트: nexartic/Portfolio
    public void InstHint(GameObject obj)
    {
        RectTransform  hintRecTrans = GetComponent <RectTransform>();
        RectTransform  objRecTrans  = obj.GetComponent <RectTransform>();
        SpriteRenderer hintSprite   = GetComponent <SpriteRenderer>();

        hintSprite.sprite = obj.GetComponent <SpriteRenderer>().sprite;
        MessageSystemGameBlock.CopyRecTransform(hintRecTrans, objRecTrans);
    }
예제 #11
0
 private void OnCollisionExit2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         onCube = true;
         MessageSystemPlayingScene.IsJump = true;
         MessageSystemGameBlock.SetPlayingConstraints();
     }
 }
예제 #12
0
파일: Event.cs 프로젝트: nexartic/Portfolio
    public void EvaStrike()
    {
        GameObject obj = MessageSystemGameBlock.ReturnNearestEnemy();

        if (obj)
        {
            obj.GetComponent <Animator>().SetBool("IsDeath", true);
        }
    }
 public static void SetDefaultVal()
 {
     setDefault();
     Storage.SetDefaultValue();
     Score.SetDefaultRecord();
     MessageSystemGameBlock.SetDefaultValue();
     Hint.SetDefaultValue();
     TapToGo.SetDefaulValue();
     OpenMenu.NumberOperation = 0;
 }
예제 #14
0
 private void OnMouseDown()
 {
     Hint.PlayClip();
     DisableButtons();
     isPause = true;
     MessageSystemGameBlock.SaveSpeed();
     MessageSystemGameBlock.StopGame();
     MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 0;
     Go.SetActive(true);
     gameObject.SetActive(false);
 }
예제 #15
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && !isDeadLine)
     {
         isDeadLine = true;
         MessageSystemPlayingScene.GeneralyPartOfDeath();
         MessageSystemPlayingScene.AutoSelectNextCharacter();
         MessageSystemGameBlock.StartGame();
         MessageSystemPlayingScene.InBodyColider = false;
     }
 }
예제 #16
0
파일: Event.cs 프로젝트: nexartic/Portfolio
 public void ExitFromTeleport()
 {
     if (!PlayerZone.IsOutside)
     {
         MessageSystemPlayingScene.SetDefaultConstraints();
     }
     else
     {
         MessageSystemGameBlock.SetPlayingConstraints();
     }
     MessageSystemPlayingScene.Player.tag = "Player";
 }
    IEnumerator FinishStopWatch()
    {
        yield return(null);

        MessageSystemGameBlock.StopStopWatch();
        while (true)
        {
            yield return(null);

            Score.NULLScoreText();
        }
    }
 public void OpenFailPanel()
 {
     Score.stop();
     TapToGo.SetActiveScreen(false);
     disableScreen.SetActive(false);
     Score.SetScoreFailPanel();
     failPanel.SetActive(true);
     MessageSystemGameBlock.ChangeLayerRight(0);
     StartCoroutine(FinishStopWatch());
     Question.DisableMenuAndQuestion();
     PauseGame.SetActivePause(false);
 }
예제 #19
0
 public static void Resume()
 {
     MessageSystemPlayingScene.EnableCollider();
     StopCollider.IsCollision        = false;
     MessageSystemPlayingScene.IsHit = false;
     MessageSystemGameBlock.StartAfterHit();
     MessageSystemPlayingScene.Player.GetComponent <Animator>().speed = 1;
     StopCollider.RestoreConstraints();
     StopCollider.PlayAnimation();
     StopCollider.SetDefaultSortingLayer();
     StopCollider.SetActiveImageButtons(false);
     panel.SetActive(false);
 }
예제 #20
0
 public void RestoreEnemy()
 {
     MessageSystemGameBlock.CopyRecTransform(buf[2], buf[0]);
     buf[1].GetComponent <Image>().color          = Color.white;
     buf[2].GetComponent <SpriteRenderer>().color = Color.white;
     buf[3].GetComponent <SpriteRenderer>().color = Color.white;
     for (int i = 1; i < 4; i++)
     {
         buf[i].gameObject.SetActive(true);
     }
     buf[2].GetComponent <Rigidbody2D>().simulated     = true;
     buf[2].GetComponent <PolygonCollider2D>().enabled = true;
     gameObject.SetActive(false);
 }
예제 #21
0
 public void RestoreRobot()
 {
     RectTransform[] bufRecTrans = GetComponentsInChildren <RectTransform>();
     for (int i = 1; i < 7; i++)
     {
         if (!bufRecTrans[i].CompareTag("Partical"))
         {
             MessageSystemGameBlock.CopyRecTransform(bufRecTrans[i], buf[i - 1]);
             bufRecTrans[i].GetComponent <Image>().color = Color.white;
         }
     }
     RobotBody.IsOne = false;
     gameObject.SetActive(false);
 }
예제 #22
0
파일: Event.cs 프로젝트: nexartic/Portfolio
 public void JumpBeforBrianHit()
 {
     MessageSystemPlayingScene.IsJump = true;
     PlayerZone.SetNoneRigid();
     MessageSystemGameBlock.SetPlayingConstraints();
     if (!MessageSystemPlayingScene.exitFromPingPong)
     {
         MessageSystemPlayingScene.exitFromPingPong = true;
     }
     if (!MessageSystemPlayingScene.IsDead)
     {
         WaitingScreen.wait(MessageSystemPlayingScene.DisableCollider());
         MessageSystemPlayingScene.Player.GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 9), ForceMode2D.Impulse);
     }
 }
 public static void GeneralyPartOfDeath()
 {
     isDead = true;
     MessageSystemGameBlock.StopGame();
     PlayerDeath(Player.name);
     countAlivePlayer--;
     inBodyColider = false;
     if (countAlivePlayer == 0)
     {
         isDead       = true;
         isFinishGame = true;
         player.SetActive(false);
         fail();
     }
 }
예제 #24
0
    protected GameObject GenerateNextEarth(GameObject currentBlock)
    {
        Storage.CountBlockEarth--;
        GameBlock  block    = MessageSystemGameBlock.ReturnDisactiveDownEarth();
        GameObject newBlock = block.GetGameObject();

        block.SetActiveFull(true);
        float         deltaMinus = -0.065f;
        BoxCollider2D curBox     = currentBlock.GetComponent <BoxCollider2D>();
        BoxCollider2D newBox     = newBlock.GetComponent <BoxCollider2D>();
        float         delta      = curBox.bounds.extents.x + newBox.bounds.extents.x + deltaMinus;

        newBlock.transform.position = new Vector3(curBox.bounds.center.x + delta, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, false);
        return(newBlock);
    }
예제 #25
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && !MessageSystemPlayingScene.IsJump)
     {
         if (!PlayerZone.IsOutside)
         {
             MessageSystemPlayingScene.SetDefaultConstraints();
         }
         else
         {
             MessageSystemGameBlock.SetPlayingConstraints();
         }
         MessageSystemPlayingScene.SetVisibleImagePlayer(true);
         MessageSystemPlayingScene.InBodyColider = false;
     }
 }
예제 #26
0
    IEnumerator Wait()
    {
        while (MessageSystemPlayingScene.inPingPong)
        {
            yield return(null);
        }
        float motorSpeed;
        int   index = (int)MessageSystemPlayingScene.Hash[MessageSystemPlayingScene.Player.name];

        motorSpeed = (float)storageVoid["0", index.ToString()]();

        var motor = slide.motor;

        motor.motorSpeed = motorSpeed;
        slide.motor      = motor;
        MessageSystemPlayingScene.Player.SetActive(true);
        slide.connectedBody = MessageSystemPlayingScene.Player.gameObject.GetComponent <Rigidbody2D>();
        MessageSystemGameBlock.SetPlayingConstraints();
    }
예제 #27
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.layer == 8)
     {
         GameObject obj = collision.gameObject;
         if (obj.CompareTag("DownEarth"))
         {
             Level_0.NewBlock = obj;
             MessageSystemGameBlock.DisableDinamicGameBlock(obj, 0);
             obj.SetActive(false);
             return;
         }
         Animator anim;
         if (anim = obj.GetComponentInChildren <Animator>())
         {
             anim.speed = 1;
         }
         obj.GetComponent <DisableGameBlock>().Disable();
     }
 }
예제 #28
0
    void GenerateNextBlock(GameObject currentBlock, out GameObject returnBlock)
    {
        int       index = 1;
        GameBlock block = new GameBlock();

        for (int i = 0; i < 3; i++)
        {
            Randomizer(ref index);
            block = MessageSystemGameBlock.ReturnUnusedGameBlock(index);
            if (block.GetGameObject() != null)
            {
                selectedBlock[index - 1] = true;
                StartCoroutine(PreparingPercent(index));
                break;
            }
            if (i == 2)
            {
                returnBlock             = GenerateNextEarth(currentBlock);
                Storage.CountBlockEarth = 0;
                return;
            }
        }
        block.CountUsing++;
        GameObject    newBlock = block.GetGameObject();
        BoxCollider2D curBox   = currentBlock.GetComponent <BoxCollider2D>();
        float         offset   = 0;

        if (block.Extents != -1)
        {
            offset = curBox.bounds.extents.x + block.Extents;
        }
        else
        {
            GenerateNextEarth(currentBlock);
            Storage.CountBlockEarth++;
        }
        newBlock.transform.position = new Vector3(curBox.bounds.center.x + offset, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, false);
        block.SetActiveFull(true);
        returnBlock = newBlock;
    }
 public static void Jump()
 {
     if (!StopCollider.IsCollision)
     {
         float powerJump = 10;
         isJump = true;
         PlayerZone.SetNoneRigid();
         MessageSystemGameBlock.SetPlayingConstraints();
         if (!exitFromPingPong)
         {
             exitFromPingPong = true;
             player.tag       = "Player";
         }
         if (!isDead)
         {
             WaitingScreen.wait(DisableCollider());
             player.GetComponent <Rigidbody2D>().AddForce(new Vector3(0, powerJump, 0), ForceMode2D.Impulse);
             player.GetComponent <Animator>().SetBool("IsJumpUp", true);
         }
     }
 }
예제 #30
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (PlayerZone.IsOutside)
     {
         PlayerZone.MoveToPlayerZone();
     }
     if (collision.gameObject.CompareTag("Player") && MessageSystemPlayingScene.IsJump && !Cube.IsCollision)
     {
         MessageSystemPlayingScene.exitFromPingPong = false;
         if (!PlayerZone.IsOutside)
         {
             MessageSystemPlayingScene.SetDefaultConstraints();
         }
         else
         {
             MessageSystemGameBlock.SetPlayingConstraints();
         }
         MessageSystemPlayingScene.IsJump = false;
         MessageSystemPlayingScene.Player.GetComponent <Animator>().SetBool("IsRunAgain", true);
         StartCoroutine(PreparationToJump());
     }
 }