コード例 #1
0
        public void Update()
        {
            if (Game3Global.GetGameState() == GameState.GS_PLAY)
            {
                //countdown Timer
                if (parashootCount > 0)
                {
                    timer -= Time.deltaTime;
                    if (timer <= 0)
                    {
                        timer += Random.Range(lvling.minParashootLength, lvling.maxParashootLength);
                        float   randPos  = Random.Range(-2.0f, 2.0f);
                        Vector2 spawnPos = parentObj.transform.position;
                        spawnPos.x += randPos;
                        //spawn Parashoot
                        GameObject obj = GameObject.Instantiate(Game3Global.pGlobal.ParashootPrefabs) as GameObject;
                        obj.transform.position = spawnPos;
                        obj.transform.parent   = parentObj.transform;
                        Parashoot pComp = obj.GetComponent <Parashoot>();
                        //random Att
                        ParashootType ran            = (ParashootType)Random.Range(0, lvling.CatagoryCount + 1);
                        float         parashootSpeed = Random.Range(lvling.minParashootSpeed, lvling.maxParashootSpeed);
                        pComp.SetParentWave(this);
                        pComp.SetParashoot(ran);
                        pComp.SetSpeed(parashootSpeed);

                        parashootCount--;
                    }
                }
            }
//			if (parashootCount <= 0)
//			{
//				Destroy (gameObject);
//			}
        }
コード例 #2
0
ファイル: Parashoot.cs プロジェクト: civalice/OryorSmartApp
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.tag == "GameBound")
     {
         //			Debug.Log("Item Lost");
         MainSoundSrc.PlaySound("wrong");
         Game3Global.BirdWrong();
         Game3Global.DecreaseLife();
         Game3Global.BrokeCombo();
         Destroy(this.gameObject);
     }
 }
コード例 #3
0
 public void CheckPerfectWave()
 {
     if (parashootClear <= 0)
     {
         if (IsPerfect)
         {
             MainSoundSrc.PlaySound("right");
             Game3Global.BirdOK();
             Game3Global.AddScore(10000);
         }
         Destroy(gameObject);
     }
 }
コード例 #4
0
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.tag == "GameBound")
     {
         MainSoundSrc.PlaySound("wrong");
         Game3Global.BirdWrong();
         Game3Global.DecreaseLife();
         Game3Global.BrokeCombo();
         Destroy(this.gameObject);
     }
     if (other.tag == "Trash")
     {
         IsEnterTrash = false;
     }
 }
コード例 #5
0
        // Update is called once per frame
        void Update()
        {
            Vector2 pos         = TouchInterface.GetTouchPosition();
            bool    isTouchDown = TouchInterface.GetTouchDown();
            bool    isTouchUp   = TouchInterface.GetTouchUp();

            if (isTouchDown && GetComponent <Collider2D>().OverlapPoint(pos))
            {
                if (Game3Global.pGlobal.dragObject == null)
                {
                    Game3Global.pGlobal.dragObject = this;
                    IsTouch = true;
                }
            }
            if (isTouchUp && Game3Global.pGlobal.dragObject == this)
            {
                //calculate score
                if (Game3Global.pGlobal.boxObject != null)
                {
                    if (Game3Global.pGlobal.boxObject.type == this.type)
                    {
                        //correct
                        MainSoundSrc.PlaySound("right");
                        Game3Global.BirdOK();
                        Game3Global.AddScore(300);
                        Game3Global.AddCombo();
                        Game3_LvlingStat.AddEXP();
                        parentWave.ParashootClear();
                        Destroy(this.gameObject);
                    }
                    else
                    {
                        MainSoundSrc.PlaySound("wrong");
                        Game3Global.BirdWrong();
                        Game3Global.BrokeCombo();
                        Game3Global.DecreaseLife();
                        parentWave.ParashootClear(false);
                        Destroy(this.gameObject);
                    }
                }
                Game3Global.pGlobal.dragObject = null;
                IsTouch = false;
            }
            if (IsTouch)
            {
                touchPos = pos;
            }
            else
            {
                if (IsEnterTrash)
                {
                    if (type != ParashootType.PARA_OTHER)
                    {
                        MainSoundSrc.PlaySound("wrong");
                        Game3Global.BirdWrong();
                        Game3Global.BrokeCombo();
                        Game3Global.DecreaseLife();
                        parentWave.ParashootClear(false);
                    }
                    else
                    {
                        MainSoundSrc.PlaySound("bin");
                        parentWave.ParashootClear();
                    }
                    Game3Global.TrashEnter();
                    Destroy(this.gameObject);
                }
            }
            UpdatePosition();
        }
コード例 #6
0
ファイル: Game3Global.cs プロジェクト: civalice/OryorSmartApp
 // Use this for initialization
 void Awake()
 {
     pGlobal = this;
 }