コード例 #1
0
ファイル: S2SquareF.cs プロジェクト: yoyo82725/JustHitIt
 void OnTriggerEnter(Collider other)
 {
     if (Time.timeScale != 0)
     {
         //被棒子揮到時
         if (other.tag == "sticks" && hitCD <= 0)
         {
             //所有元件閃紅 往上位移
             for (int i = 0; i < this.transform.childCount; i++)
             {
                 this.transform.GetChild(i).renderer.material.color = Color.red;
             }
             blinkRed = true;
             transform.Translate(0, 1, 0, Space.World);
             //加HP
             int addHP = PlayingManager.addHP * 5;
             if (GameManager.wearSk1 == 6 || GameManager.wearSk2 == 6 || GameManager.wearSk3 == 6)
             {
                 addHP += GameManager.skLv[5] * 50 + (int)((float)addHP * Random.Range(-0.1f, 0.1f));
             }
             else
             {
                 addHP += (int)((float)addHP * Random.Range(-0.1f, 0.1f));
             }
             PlayingManager.stageHp += addHP;
             PlayingManager.ShowPlus(addHP, this.transform.position);
             AudioSource.PlayClipAtPoint(hitSE, Vector3.one);
             hitCD = 0.2f;
         }
     }
 }
コード例 #2
0
ファイル: OutBallCube.cs プロジェクト: yoyo82725/JustHitIt
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            //+血
            int addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f, 0.1f));
            PlayingManager.stageHp += addHP;
            PlayingManager.ShowPlus(addHP, this.transform.position);
            PlayingManager.brkCnt++;
            GameManager.playerExp += PlayingManager.getExp;
            GameManager.money     += PlayingManager.getMoney;
            GameManager.breakCnt++;
            if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
            {
                PlayingManager.mineHp += PlayingManager.sk11Pow;
                if (PlayingManager.mineHp > PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp = PlayingManager.mineHpL;
                }
            }

            AudioSource.PlayClipAtPoint(boomSE, Vector3.one + Vector3.one, 0.5f);
            Destroy(this.gameObject);
            Instantiate(boom, transform.position, Quaternion.identity);
        }
    }
コード例 #3
0
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            //+血
            int addHP = PlayingManager.addHP / 2 + (int)((float)PlayingManager.addHP * 0.5f * Random.Range(-0.1f, 0.1f));
            PlayingManager.stageHp += addHP;
            PlayingManager.ShowPlus(addHP, this.transform.position);
            PlayingManager.brkCnt++;
            GameManager.playerExp += PlayingManager.getExp / 2;
            GameManager.money     += PlayingManager.getMoney / 2;
            GameManager.breakCnt++;
            if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
            {
                PlayingManager.mineHp += PlayingManager.sk11Pow;
                if (PlayingManager.mineHp > PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp = PlayingManager.mineHpL;
                }
            }

            AudioSource.PlayClipAtPoint(boomSE, Vector3.one + Vector3.one, 0.5f);
            Destroy(this.gameObject);
            Instantiate(boom, transform.position, Quaternion.identity);
        }
        //刪除
        else if (other.tag == "deleteLine")
        {
            //-血
            int minusHP = PlayingManager.minusHP / 2 + (int)((float)PlayingManager.minusHP * 0.5f * Random.Range(-0.1f, 0.1f));
            PlayingManager.mineHp -= minusHP;
            PlayingManager.ShowPlus(minusHP, this.transform.position, true);
            PlayingManager.lostCount++;

            AudioSource.PlayClipAtPoint(minusHpSE, Vector3.one, 0.5f);
            //玻璃球
            if (this.name == "GlassBall" || this.name == "TopGlassBall")
            {
                Destroy(this.transform.parent.gameObject);
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
    }
コード例 #4
0
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            if (hitCount == 0)
            {
                AudioSource.PlayClipAtPoint(littleBoomSE, Vector3.one, 0.5f);
                this.transform.parent     = null;
                this.rigidbody.useGravity = true;
                hitCount++;
                if (havP)
                {
                    this.rigidbody.AddForce(0f, 700f, 0f);
                }
                else
                {
                    this.rigidbody.AddForce(0f, 1500f, 0f);
                }
                Instantiate(littleBoom, new Vector3(transform.position.x, transform.position.y, 0f), Quaternion.identity);
                this.renderer.materials[0].color = Color.gray;
                this.renderer.materials[1].color = Color.gray;
                timer = 0.2f;
            }
            else if (timer <= 0)
            {
                //+血
                int addHP = PlayingManager.addHP * 2 + (int)((float)PlayingManager.addHP * 2f * Random.Range(-0.1f, 0.1f));
                PlayingManager.stageHp += addHP;
                PlayingManager.ShowPlus(addHP, this.transform.position);
                PlayingManager.brkCnt++;
                GameManager.playerExp += PlayingManager.getExp * 2;
                GameManager.money     += PlayingManager.getMoney * 2;
                GameManager.breakCnt++;
                if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp += PlayingManager.sk11Pow;
                    if (PlayingManager.mineHp > PlayingManager.mineHpL)
                    {
                        PlayingManager.mineHp = PlayingManager.mineHpL;
                    }
                }

                AudioSource.PlayClipAtPoint(boomSE, Vector3.one, 0.5f);
                Destroy(this.gameObject);
                Instantiate(boom, new Vector3(transform.position.x, transform.position.y, 0f), Quaternion.identity);
            }
        }
        //刪除
        else if (other.tag == "deleteLine")
        {
            //-血
            int minusHP = PlayingManager.minusHP + (int)((float)PlayingManager.minusHP * Random.Range(-0.1f, 0.1f));
            PlayingManager.mineHp -= minusHP;
            PlayingManager.ShowPlus(minusHP, this.transform.position, true);
            PlayingManager.lostCount++;

            AudioSource.PlayClipAtPoint(minusHpSE, Vector3.one, 0.5f);
            Destroy(this.gameObject);
        }
    }
コード例 #5
0
ファイル: FireBall.cs プロジェクト: yoyo82725/JustHitIt
    void OnTriggerEnter(Collider other)
    {
        //棒子
        if ((other.tag == "sticks" && UserScreen.hitting > 0) || other.tag == "playerBall")
        {
            //+血
            int addHP;
            if (ballCo == 0)
            {
                addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f, 0.1f));
            }
            else if (ballCo == 1)
            {
                addHP = (int)((float)PlayingManager.addHP * 1.3f) + (int)((float)PlayingManager.addHP * 1.3f * Random.Range(-0.1f, 0.1f));
            }
            else if (ballCo == 7)
            {
                addHP = (int)(PlayingManager.sk4Pow * Random.Range(-0.1f, 0.1f));
            }
            else
            {
                addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f, 0.1f));
                //分裂
                if (ballCo == 2)
                {
                    GameObject testV;
                    //int amount=Random.Range(2,5);
                    for (int i = 0; i < 4; i++)
                    {
                        testV = Instantiate(splitBall, transform.position, Quaternion.identity) as GameObject;
                        testV.rigidbody.AddForce((Random.Range(-80.0f, 80.0f)), (Random.Range(400.0f, 600.0f)), 0);
                        PlayingManager.outCount++;
                    }
                }
                //吹風
                else if (ballCo == 3)
                {
                    Instantiate(windBallWind, Vector3.zero, Quaternion.identity);
                    AudioSource.PlayClipAtPoint(windSE, Vector3.forward);
                }
                //煙霧
                else if (ballCo == 4)
                {
                    Instantiate(smokeBallSmoke, new Vector3(this.transform.position.x * 0.04545f, this.transform.position.y * 0.07142f, -7.0f), Quaternion.identity);
                }
                //移動加速BUFF
                else if (ballCo == 5)
                {
                    AudioSource.PlayClipAtPoint(buffSE, Vector3.zero);
                    if (MoveSpeedUpBuff.isShow)
                    {
                        MoveSpeedUpBuff.timer = 0f;
                    }
                    else
                    {
                        if (StickBigBuff.isShow)
                        {
                            Instantiate(moveSpeedUpBuff, new Vector3(-9.67f, 5f, 0f), Quaternion.identity);
                        }
                        else
                        {
                            Instantiate(moveSpeedUpBuff, new Vector3(-10.37f, 5f, 0f), Quaternion.identity);
                        }
                    }
                }
                //大棒BUFF
                else if (ballCo == 6)
                {
                    AudioSource.PlayClipAtPoint(buffSE, Vector3.zero);
                    if (StickBigBuff.isShow)
                    {
                        StickBigBuff.timer = 0f;
                    }
                    else
                    {
                        if (MoveSpeedUpBuff.isShow)
                        {
                            Instantiate(stickBigBuff, new Vector3(-9.67f, 5f, 0f), Quaternion.identity);
                        }
                        else
                        {
                            Instantiate(stickBigBuff, new Vector3(-10.37f, 5f, 0f), Quaternion.identity);
                        }
                    }
                }
            }
            PlayingManager.stageHp += addHP;
            PlayingManager.ShowPlus(addHP, this.transform.position);
            PlayingManager.brkCnt++;
            GameManager.playerExp += PlayingManager.getExp;
            GameManager.money     += PlayingManager.getMoney;
            GameManager.breakCnt++;
            if (PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL)
            {
                PlayingManager.mineHp += PlayingManager.sk11Pow;
                if (PlayingManager.mineHp > PlayingManager.mineHpL)
                {
                    PlayingManager.mineHp = PlayingManager.mineHpL;
                }
            }

            Instantiate(boom, transform.position, Quaternion.identity);
            AudioSource.PlayClipAtPoint(boomSE, Vector3.one, 0.5f);
            //玻璃球
            if (ballCo == 1)
            {
                Destroy(this.transform.parent.gameObject);
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
        //刪除
        else if (other.tag == "deleteLine")
        {
            //-血
            int minusHP = PlayingManager.minusHP + (int)((float)PlayingManager.minusHP * Random.Range(-0.1f, 0.1f));
            PlayingManager.mineHp -= minusHP;
            PlayingManager.ShowPlus(minusHP, this.transform.position, true);
            PlayingManager.lostCount++;

            AudioSource.PlayClipAtPoint(minusHpSE, Vector3.one, 0.5f);
            //玻璃球
            if (ballCo == 1)
            {
                Destroy(this.transform.parent.gameObject);
            }
            else
            {
                Destroy(this.gameObject);
            }
        }
    }
コード例 #6
0
	void OnTriggerEnter(Collider other){
		//棒子
		if((other.tag=="sticks" && UserScreen.hitting>0) || other.tag=="playerBall"){
			this.transform.parent=null;
			this.rigidbody.useGravity=true;
			this.rigidbody.AddForce(0,2000,0);
			AudioSource.PlayClipAtPoint(littleBoomSE,Vector3.one+Vector3.one,0.5f);
			if(PlayingManager.sk11On && PlayingManager.mineHp < PlayingManager.mineHpL){
				PlayingManager.mineHp += PlayingManager.sk11Pow;
				if(PlayingManager.mineHp > PlayingManager.mineHpL){
					PlayingManager.mineHp = PlayingManager.mineHpL;
				}
			}
			playerBall=true;
			this.tag="playerBall";
		}
		//刪除
		else if(other.tag=="deleteLine"){
			//-血
			int minusHP = PlayingManager.minusHP + (int)((float)PlayingManager.minusHP * Random.Range(-0.1f,0.1f));
			PlayingManager.mineHp -= minusHP;
			PlayingManager.ShowPlus(minusHP,this.transform.position,true);
			PlayingManager.lostCount++;

			AudioSource.PlayClipAtPoint(minusHpSE,Vector3.one+Vector3.one,0.5f);
			Destroy(this.gameObject);
		}else if(playerBall){
			if(other.tag=="fireBall"){
				//打到球
				Instantiate(boom,this.transform.position,Quaternion.identity);
				AudioSource.PlayClipAtPoint(boomSE,Vector3.one+Vector3.one,0.5f);
				//加HP
				int addHP;
				if (GameManager.wearSk1 == 5 || GameManager.wearSk2 == 5 || GameManager.wearSk3 == 5) {
					//sk迴球特好
					addHP = PlayingManager.addHP + GameManager.skLv[4]*20 + (int)((float)PlayingManager.addHP * Random.Range(-0.1f,0.1f));
				}else{
					addHP = PlayingManager.addHP + (int)((float)PlayingManager.addHP * Random.Range(-0.1f,0.1f));
				}
				PlayingManager.stageHp += addHP;
				PlayingManager.ShowPlus(addHP,this.transform.position);
				GameManager.playerExp += PlayingManager.getExp;
				GameManager.money += PlayingManager.getMoney;
				GameManager.breakCnt++;

				Destroy(this.gameObject);
			}else if(other.tag=="StageBoss"){
				//打到BOSS
				other.transform.Translate(0,2,0,Space.World);
				//加HP
				int addHP;
				if (GameManager.wearSk1 == 5 || GameManager.wearSk2 == 5 || GameManager.wearSk3 == 5) {
					//sk迴球特好
					addHP = PlayingManager.addHP*5 + GameManager.skLv[4]*20 + (int)((float)PlayingManager.addHP*5f * Random.Range(-0.1f,0.1f));
				}else{
					addHP = PlayingManager.addHP*5 + (int)((float)PlayingManager.addHP*5f * Random.Range(-0.1f,0.1f));
				}
				PlayingManager.stageHp += addHP;
				PlayingManager.ShowPlus(addHP,this.transform.position);
				GameManager.playerExp += PlayingManager.getExp;
				GameManager.money += PlayingManager.getMoney;
				GameManager.breakCnt++;

				AudioSource.PlayClipAtPoint(boomSE,Vector3.one+Vector3.one,0.5f);
				Instantiate(boom,this.transform.position,Quaternion.identity);
				Destroy(this.gameObject);
			}
		}
	}