コード例 #1
0
ファイル: TruckRush.cs プロジェクト: BBJV/camachi
 IEnumerator CarRush(CarProperty car)
 {
     if(rush)
         yield break;
     skillUsing = true;
     rush = true;
     car.AddSkillTime();
     foreach(GameObject effect in speedUpEffects)
     {
         effect.active = true;
     }
     car.SlowDown(false);
     car.RPMUp(skillSetting[skillLevel - 1].effectPercent);
     car.TorqueUp(skillSetting[skillLevel - 1].effectPercent, Color.white);
     car.CanBrake(false);
     RushHornAudio.Play();
     /* show effect
     while(){}
     */
     yield return new WaitForSeconds(skillSetting[skillLevel - 1].skillEffectTimes);
     car.SlowDown(true);
     car.RPMUp(0);
     car.TorqueUp(0, Color.white);
     car.CanBrake(true);
     foreach(GameObject effect in speedUpEffects)
     {
         effect.active = false;
     }
     rush = false;
     skillUsing = false;
     RushHornAudio.Stop();
 }
コード例 #2
0
ファイル: TrashStorm.cs プロジェクト: BBJV/camachi
    IEnumerator trashStorm(CarProperty car)
    {
        //-----------------------I added-------------------------------------------------
        //		carlevel2 = dc.carLevel;

        //skills play level1~level5
        if(carlevel2==1)
        {
            //how long the skill can play
            skillEffectTime=10.0f;

            //the car which is effected by the skill it can't stop itself
            car.CanBrake(false);

            // if skill played the car will light
        //			GameObject.Find("groundObstacle").active = true;
            groundObstacle.gameObject.active=true;
            groundObstacle.transform.position=targetPosition.position;

            //finish the skill after 5 seconds
            yield return new WaitForSeconds(skillEffectTime);
            groundObstacle.gameObject.active=false;
            screenGarbage.gameObject.active=false;

        }

        //skill level2
        if(carlevel2==2)
        {
                //how long the skill can play
            skillEffectTime=12.0f;

            //the car which is effected by the skill it can't stop itself
            car.CanBrake(false);

            // if skill played the car will light
        //			GameObject.Find("groundObstacle").active = true;
            groundObstacle.gameObject.active=true;
            groundObstacle.transform.position=targetPosition.position;

            //finish the skill after 5 seconds
            yield return new WaitForSeconds(skillEffectTime);
            groundObstacle.gameObject.active=false;
            screenGarbage.gameObject.active=false;

        }

        //skill level3
        if(carlevel2==3)
        {
                    //how long the skill can play
            skillEffectTime=14.0f;

            //the car which is effected by the skill it can't stop itself
            car.CanBrake(false);

            // if skill played the car will light
        //			GameObject.Find("groundObstacle").active = true;
            groundObstacle.gameObject.active=true;
            groundObstacle.transform.position=targetPosition.position;

            //finish the skill after 5 seconds
            yield return new WaitForSeconds(skillEffectTime);
            groundObstacle.gameObject.active=false;
            screenGarbage.gameObject.active=false;

        }

        //skill level4
        if(carlevel2==4)
        {
                    //how long the skill can play
            skillEffectTime=16.0f;

            //the car which is effected by the skill it can't stop itself
            car.CanBrake(false);

            // if skill played the car will light
        //			GameObject.Find("groundObstacle").active = true;
            groundObstacle.gameObject.active=true;
            groundObstacle.transform.position=targetPosition.position;

            //finish the skill after 5 seconds
            yield return new WaitForSeconds(skillEffectTime);
            groundObstacle.gameObject.active=false;
            screenGarbage.gameObject.active=false;

        }

        //skill level5
        if(carlevel2==5)
        {
                    //how long the skill can play
            skillEffectTime=18.0f;

            //the car which is effected by the skill it can't stop itself
            car.CanBrake(false);

            // if skill played the car will light
        //			GameObject.Find("groundObstacle").active = true;
            groundObstacle.gameObject.active=true;
            groundObstacle.transform.position=targetPosition.position;

            //finish the skill after 5 seconds
            yield return new WaitForSeconds(skillEffectTime);
            groundObstacle.gameObject.active=false;
            screenGarbage.gameObject.active=false;

        }
        //-----------------------I added-------------------------------------------------
    }