Exemplo n.º 1
0
    void RegisterWordHit(ClickAreaCtrl cArea, WordGameObjectCtrl wrd)
    {
        if (wrd.isFake)
        {
            //Debug.Log("FAKE HIT");
            ScoreCtrl.FakeClick();
            UIEventManager.FakeWordHitEvent();
            return;
        }

        hitFX = PoolManager.SpawnObject(successWordHitFX);
        HitWordFX hitWordFX = hitFX.GetComponent <HitWordFX>();

        isPerfect = Mathf.Abs(currentAudioTime - wrd.hitTime) < Config.CLICK_PERFECT_TIME_OFFSET;
        if (isPerfect)
        {
            hitWordFX.perfect = true;
        }
        else
        {
            hitWordFX.perfect = false;
        }
        GameLogger.AddTap(wrd.hitTime, currentAudioTime, wrd.wordData.text);
        hitFX.transform.position = cArea.gameObject.transform.position;
        hitWordFX.runAnim();
        ScoreCtrl.WordHit(wrd.orderIndex, currentAudioTime, wrd.hitTime, isPerfect);
    }
Exemplo n.º 2
0
 void BombScreen()
 {
     GameObject[] blocks = GameObject.FindGameObjectsWithTag("falling-block");
     foreach (GameObject block in blocks)
     {
         block.GetComponent <FallingBlock> ().ExplodeAndDestroy();
         ScoreCtrl.AddScore();
     }
 }
Exemplo n.º 3
0
	void OnLevelUp(){
		int level = ScoreCtrl.GetLevel ();
		if (level == 1) {
			gunManager.SetRelativeShootSpeed (1.5f);
		} else if (level == 2) {
			gunManager.SetRelativeShootSpeed (2f);
		} else if (level == 3) {
			gunManager.SetRelativeShootSpeed (3f);
		} else if (level == 4) {
			gunManager.SetRelativeShootSpeed (4f);
		}
	}
 bool CanSpawnNextWeapon()
 {
     if (nextSpawnTimeIndex < spawnTime.Length)
     {
         // check time threshold
         if (Time.time >= startTime + spawnTime [nextSpawnTimeIndex])
         {
             // check score threshold
             return(ScoreCtrl.GetScore() >= scoreThreshold[nextSpawnTimeIndex]);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 void OnTriggerExit2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "WordCollider")
     {
         wordCtrl = coll.gameObject.GetComponent <WordGameObjectCtrl>();
         if (!wordCtrl.isClicked && !wordCtrl.isFake)
         {
             ScoreCtrl.WordMiss();
         }
         if (colliders.Contains(wordCtrl))
         {
             colliders.Remove(wordCtrl);
         }
     }
 }
Exemplo n.º 6
0
    /*
     * PREPARE THE GAMESCREEN
     * Enable/Disable elements
     * finaly start loading AUDIO ASSET
     */

    void OnPrepareEvent()
    {
        listIndex    = 0;
        nextShowTime = 0;
        nextHitTime  = 0;
        foreach (ClickAreaCtrl c in clickAreas)
        {
            c.gameObject.SetActive(true);
        }
        gameElements.SetActive(true);
        gameUI.SetActive(true);
        ScoreCtrl.ResetScore();
        clicksCount = 0;
        StartCoroutine(LoadAudioAsset());

        GameLogger.Reset();
    }
Exemplo n.º 7
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "player")
     {
         other.gameObject.GetComponent <Player> ().TakeDamage(damage);
         ExplodeAndDestroy();
     }
     else if (other.tag == "bullet")
     {
         Destroy(other.gameObject);
         ExplodeAndDestroy();
         ScoreCtrl.AddScore();
     }
     else if (other.tag == "weapon")
     {
         ExplodeAndDestroy();
         ScoreCtrl.AddScore();
     }
 }
Exemplo n.º 8
0
    void UpdateUI()
    {
        int level = ScoreCtrl.GetLevel();

        levelUI.text = "L " + level;
    }
    void UpdateUI()
    {
        int score = ScoreCtrl.GetScore();

        pointsUI.text = score + " pts";
    }
Exemplo n.º 10
0
 void Awake()
 {
     bc = GetComponent <BoxCollider2D>();//BoxCollider2D를 넣어줌
     EM = GameObject.FindWithTag("ENEMY").GetComponent <Enemy>();
     SC = GameObject.Find("Center").GetComponent <ScoreCtrl>();
 }
Exemplo n.º 11
0
 //REGISTER ANY CLICK ON BUTTON
 void RegisterEmptyClick()
 {
     ScoreCtrl.EmptyClick();
 }
Exemplo n.º 12
0
    void CheckTouches()
    {
        if (Input.touchCount < 1)
        {
            return;
        }

        foreach (Touch touch in Input.touches)
        {
            if (touch.phase == TouchPhase.Began)
            {
                RaycastHit2D hitInfo = Physics2D.Raycast(cam.ScreenToWorldPoint(touch.position), Vector2.zero);
                if (hitInfo)
                {
                    GameObject recipient = hitInfo.transform.gameObject;
                    if (recipient.tag == "ClickArea")
                    {
                        clickAreaCtrl   = recipient.GetComponent <ClickAreaCtrl>();
                        wgCollidingCtrl = clickAreaCtrl.GetCollidingWord(); // returns a word if it is not clicked already
                        if (wgCollidingCtrl != null)
                        {
                            RegisterWordHit(clickAreaCtrl, wgCollidingCtrl);
                            if (wgCollidingCtrl.wordData.duration > 0.0)
                            {
                                clickAreaCtrl.StartHolding(touch.fingerId, (float)wgCollidingCtrl.wordData.duration, currentAudioTime);
                            }
                        }
                        else
                        {
                            // empty click. kill streak
                            //RegisterWordMiss(clickAreaCtrl);
                            RegisterEmptyClick();
                        }
                    }
                }
            }

            if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
            {
                foreach (ClickAreaCtrl caCtrl in clickAreas)
                {
                    if (touch.fingerId == caCtrl.fingerIdDown)
                    {
                        //Debug.Log("STOP HOLDING " + caCtrl.gameObject.name + " fid =" +caCtrl.fingerIdDown+ " WITH FINGER ID "+ touch.fingerId);
                        float timePressed = currentAudioTime - caCtrl.startHoldTime;
                        //Debug.Log("HODING FOR : " + timePressed + " ["+caCtrl.durationToHold+"]");
                        caCtrl.fingerIdDown   = 100;
                        caCtrl.startHoldTime  = 0;
                        caCtrl.durationToHold = 0;
                        caCtrl.StopParticles();
                    }
                }
            }

            if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary)
            {
                foreach (ClickAreaCtrl caCtrl in clickAreas)
                {
                    if (caCtrl.fingerIdDown != 100 && caCtrl.durationToHold != 0)
                    {
                        ScoreCtrl.AddHoldPoints(caCtrl.wordCtrl.hitTime, caCtrl.startHoldTime, caCtrl.durationToHold, currentAudioTime);
                    }
                }
            }
        }
    }
 private void Awake()
 {
     self = this;
 }
Exemplo n.º 14
0
 void ResetStaticComponents()
 {
     ScoreCtrl.Reset();
     WeaponStoreCtrl.Reset();
 }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     finalScoreDisplay.text = "" + ScoreCtrl.GetScore();
 }
Exemplo n.º 16
0
 void Start()
 {
     Ctrl = GameObject.Find("RewardCtrl").GetComponent <ScoreCtrl>();
 }