Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        gemPool     = FindObjectOfType <GemPool>();
        audioSource = FindObjectOfType <PersistentAudioSource>();
        gemsLeft    = availableGems;

        UpdateGemColorInOre();
    }
Exemplo n.º 2
0
	// Use this for initialization

	void Awake()
	{
		if (Instance != null && Instance != this)
		{
			Destroy(gameObject);
		}
		Instance = this;
		// Furthermore we make sure that we don't destroy between scenes (this is optional)
		DontDestroyOnLoad(gameObject);
	}
Exemplo n.º 3
0
    // Use this for initialization

    void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        Instance = this;
        // Furthermore we make sure that we don't destroy between scenes (this is optional)
        DontDestroyOnLoad(gameObject);
    }
Exemplo n.º 4
0
    public void Reset()
    {
        if (GameManager.isHandheld)
        {
            androidInputs = null;
        }

        gemPouch.Clear();

        gemPool = null;

        currentPouchSize = 0;
        promptInput      = false;
        score            = 0;
        ResetAnimations();
    }
Exemplo n.º 5
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.º 6
0
    private void Start()
    {
        rb = GetComponent <Rigidbody>();
        if (GameManager.isClient)
        {
            rb.isKinematic = true;
            var colliders = GetComponentsInChildren <Collider>();
            foreach (var c in colliders)
            {
                c.enabled = false;
            }
        }
        gemPool     = FindObjectOfType <GemPool>();
        audioSource = FindObjectOfType <PersistentAudioSource>();
        currentTier = tiers[0];

        SpawnnForce();
    }
Exemplo n.º 7
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "LadderTop")
        {
            ladderTopReached = true;
        }

        if (other.tag == "Ladder")
        {
            climbingLadder = true;
        }

        if (other.tag == "Minecart")
        {
            if (gemPouch.Count != 0)
            {
                float scoreObtained   = 0;
                float scoreMultiplier = 1f;
                int   currentGems     = gemPouch.Count;

                if (GameManager.isLocalGame || GameManager.isHost)
                {
                    other.GetComponent <Minecart>().ComboText(currentGems);
                }

                for (int i = 0; i < currentGems; i++)
                {
                    Gem gem = gemPouch.Dequeue();

                    scoreObtained += gem.value;
                    currentPouchSize--;
                    scoreMultiplier += scoreIncrementPerGemStored;

                    if (gemPool != null)
                    {
                        gemPool.ReturnObjectToPool(gem.gameObject);
                    }
                    else
                    {
                        gemPool = FindObjectOfType <GemPool>();

                        if (gemPool != null)
                        {
                            gemPool.ReturnObjectToPool(gem.gameObject);
                        }
                        else
                        {
                            Debug.LogError("Gem Pool Not Found");
                        }
                    }
                }

                if (currentPouchSize < 0)
                {
                    currentPouchSize = 0;
                }

                AddScore(Mathf.CeilToInt(scoreObtained * scoreMultiplier));

                UpdateSpeed();
                CheckPouchFull();
                ChangePouchSize();
            }
        }
    }