コード例 #1
0
ファイル: QuickFire.cs プロジェクト: supersteevie/FabTankWar
    void FireMissle()
    {
        GameObject clone;

        clone = Instantiate(PrefabBullet, turretLoc.transform.position, turretLoc.transform.rotation) as GameObject;
        clone.GetComponent <JudgeProjectiles> ().FireProjectile(GameObject.Find("Cannon").transform, GameObject.Find("GameHandler").GetComponent <RunwayHandler>().timerBuff, ProjectileType.Missle, true);
        SoundEffectsPlayer.PlayAudio(SoundEffects.TankFire);
        clone.transform.localScale = new Vector3(5, 5, 5);
    }
コード例 #2
0
    //Calls the buff shield quick time event
    IEnumerator CallBuff()
    {
        GameObject clone;

        clone = Instantiate(PrefabBullet, GameObject.Find("Cannon").transform.position, GameObject.Find("Cannon").transform.rotation) as GameObject;
        clone.GetComponent <JudgeProjectiles> ().FireProjectile(playerObj.transform, timerBuff / 1.3f, ProjectileType.Bomb, true);
        SoundEffectsPlayer.PlayAudio(SoundEffects.TurretFire);
        yield return(uiBuff.GetComponent <QuickBuff>().StartCoroutine("StartTimer", timerBuff));

        limitBuff--;
        nbrTotal++;
        yield return(null);
    }
コード例 #3
0
    //Determines which quick pattern event to call depending on the lane of the player's tank
    IEnumerator CallSwipe()
    {
        int swipeObj;

        if (playerObj.transform.position.x >= 3)                //Player is in the right lane, call only swipe left events
        {
            for (int i = 0; i < 2; i++)
            {
                allSwipes[i] = uiSwipeL[swipeMin + i];
            }
            swipeObj = Random.Range(0, 2);
            CalcMovement(1);
        }
        else if (playerObj.transform.position.x <= -3)         //Player is in the left lane, call only swipe right events
        {
            for (int i = 0; i < 2; i++)
            {
                allSwipes[i] = uiSwipeR[swipeMin + i];
            }
            swipeObj = Random.Range(0, 2);
            CalcMovement(2);
        }
        else                                                                                            //Player is in the center lane, call all swipe events
        {
            for (int i = 0; i < 2; i++)
            {
                allSwipes[i]     = uiSwipeL[swipeMin + i];
                allSwipes[i + 2] = uiSwipeR[swipeMin + i];
            }
            swipeObj = Random.Range(0, allSwipes.Length);
            CalcMovement(swipeObj);
        }

        GameObject clone;

        clone = Instantiate(PrefabBullet, GameObject.Find("Cannon").transform.position, GameObject.Find("Cannon").transform.rotation) as GameObject;
        clone.GetComponent <JudgeProjectiles> ().FireProjectile(playerObj.transform, timerBuff / 1.3f, ProjectileType.Missle, false);
        SoundEffectsPlayer.PlayAudio(SoundEffects.TurretFire);
        yield return(allSwipes[swipeObj].GetComponent <QuickSwipe>().StartCoroutine("StartQuickSwipeEvent", timerSwipe));

        //If player won last swipe event
        if (swipeWin)
        {
            //increase the range for higher difficulty events
            swipeMin += swipeMin < uiSwipeL.Length - 2 ? 1 : 0;
            swipeMax += swipeMax < uiSwipeL.Length - 1 ? 1 : 0;

            //decrease time window for the win condition
            swpBonus += swpIncr;
        }

        //If pplayer lost last swipe event
        if (!swipeWin && !swipeTie)
        {
            //decrease the range for lower difficulty events
            swipeMax -= swipeMin != 0 ? 1 : 0;
            swipeMin -= swipeMin >= 1 ? 1 : 0;

            //increase time window for the win condition
            swpBonus -= swpBonus < .5 ? swpIncr : 0;
        }


        limitSwipe--;
        nbrTotal++;

        //Debug.Log("executed to quick swipe");
        yield return(null);
    }