Exemplo n.º 1
0
 void Update()
 {
     if (gameOver && canRestart)
     {
         if (Application.platform == RuntimePlatform.Android && AndroidInputs.getAnyTouchBeginInput())
         {
             restart = true;
         }
         else if (Application.platform == RuntimePlatform.WindowsEditor && Input.anyKey)
         {
             restart = true;
         }
     }
     if (!gameOver)
     {
         if (background.GetComponent <Transform>().position.z < -4)
         {
             background.GetComponent <Transform>().position = new Vector3(0, 0, 150);
         }
         else if (background.GetComponent <Transform>().position.z < 10)
         {
             background.GetComponent <Transform>().position = new Vector3(0, 0, background.GetComponent <Transform>().position.z - 0.0001f);
         }
         else
         {
             background.GetComponent <Transform>().position = new Vector3(0, 0, background.GetComponent <Transform>().position.z - 0.01f);
         }
     }
 }
Exemplo n.º 2
0
    private void MobileInputs()
    {
        if (GameManager.isHandheld)
        {
            if (androidInputs == null)
            {
                androidInputs = FindObjectOfType <AndroidInputs>();
            }

            //Online game
            if (!GameManager.isLocalGame)
            {
                //Caso de las máquinas del host
                if (!GameManager.isHost)
                {
                    //Manda input por red
                    playerOwner.networkPlayer.inputInfo.pickaxeInput = androidInputs.GetPickaxeInput();
                    PickaxeHit();
                }

                else //Máquina host y jugador host
                {
                    pickaxeInput = androidInputs.GetPickaxeInput();
                    PickaxeHit();
                }
            }
            //Local game
            else
            {
                pickaxeInput = androidInputs.GetPickaxeInput();
                PickaxeHit();
            }
        }
    }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        boxColliders = GetComponents <BoxCollider>();
        audioSource  = FindObjectOfType <PersistentAudioSource>();

        androidInputs = FindObjectOfType <AndroidInputs>();

        EnableCollisions(false);
    }
Exemplo n.º 4
0
 void Update()
 {
     if (Application.platform == RuntimePlatform.Android && AndroidInputs.getAnyTouchBeginInput())
     {
         canStart = true;
     }
     else if (Application.platform == RuntimePlatform.WindowsEditor && Input.GetKeyDown(KeyCode.G))
     {
         canStart = true;
     }
 }
Exemplo n.º 5
0
    public void ResetPickaxe()
    {
        if (GameManager.isHandheld)
        {
            androidInputs = null;
        }

        pickaxeInput = 0f;

        hitOnCooldown = false;
        pickaxeReset  = false;

        EnableCollisions(false);
    }
Exemplo n.º 6
0
    public void Reset()
    {
        if (GameManager.isHandheld)
        {
            androidInputs = null;
        }

        gemPouch.Clear();

        gemPool = null;

        currentPouchSize = 0;
        promptInput      = false;
        score            = 0;
        ResetAnimations();
    }
Exemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        avatar = GetComponent <PlayerAvatar>();

        //Si es el jugador local
        //if(GameManager.isLocalGame || GameManager.isHost)
        androidInputs = FindObjectOfType <AndroidInputs>();

        networkPlayer = GetComponent <NetworkPlayer>();

        gameUIManager = FindObjectOfType <GameUIManager>();

        gemPool = FindObjectOfType <GemPool>();

        audioSource = FindObjectOfType <PersistentAudioSource>();

        if (!PlayerSpawnerManager.isInHub)
        {
            gameUIManager.ActivatePlayerUI(playerNumber, userInfo.id);
        }

        rb = gameObject.GetComponent <Rigidbody>();

        horizontalSpeed = startingHorizontalSpeed;
        verticalSpeed   = startingVerticalSpeed;

        maxHorizontalSpeed = startingMaxHorizontalSpeed;
        maxVerticalSpeed   = startingMaxVerticalSpeed;

        currentTier = gemPouchTiers[0];
        ChangePouchSize();

        if (!GameManager.isLocalGame)
        {
            if (GameManager.isHost)
            {
                animator.runtimeAnimatorController = hostAnimator;
            }
            else if (GameManager.isClient)
            {
                animator.runtimeAnimatorController = clientAnimator;
            }
        }

        groundMeshOrientation = playerMesh.transform.right;
    }
Exemplo n.º 8
0
    private void MobileInputs()
    {
        if (GameManager.isHandheld)
        {
            if (androidInputs == null)
            {
                androidInputs = FindObjectOfType <AndroidInputs>();
            }

            //Online game
            if (!GameManager.isLocalGame)
            {
                //Caso de las máquinas del host
                if (!GameManager.isHost)
                {
                    //Manda input por red
                    networkPlayer.inputInfo.joystick      = androidInputs.GetMovementInput();
                    networkPlayer.inputInfo.throwGemInput = androidInputs.GetThrowGemInput();
                }

                else //Máquina host y jugador host
                {
                    joystick      = androidInputs.GetMovementInput();
                    throwGemInput = androidInputs.GetThrowGemInput();
                    ThrowGem();
                }
            }
            //Local game
            else
            {
                joystick      = androidInputs.GetMovementInput();
                throwGemInput = androidInputs.GetThrowGemInput();
                ThrowGem();
            }
        }
    }