Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 IEnumerator ReduceEnergySkill(CarProperty car)
 {
     //		Debug.Log("Use");
     float _time = time;
     while(_time > 0)
     {
         Collider[] targets = Physics.OverlapSphere(transform.position, radius);
         Transform targetTransform = null;
         foreach(Collider target in targets)
         {
             if(target.transform.root.tag == "car" && (target.transform.root != targetTransform) &&
                (target.transform.root != transform) &&
                (Vector3.Dot(transform.TransformDirection(Vector3.right),target.transform.root.position - transform.position) > 0))
             {
                 targetTransform = target.transform.root;
     //					Debug.Log(target.transform.root.name + " " + target.name);
                 DamageController dc = target.transform.root.GetComponent<DamageController>();
                 if(dc)
                     dc.ApplyDamageEnergy(percent);
             }
         }
         yield return new WaitForSeconds(1);
         _time -= 1;
     }
 }
Ejemplo n.º 3
0
 public override void Use(CarProperty car, int level)
 {
     if(!smoothFollow)
         smoothFollow = Camera.main.GetComponent<SmoothFollow>();
     base.Use(car, level);
     StartCoroutine(InvincibleCar(car));
 }
Ejemplo n.º 4
0
    //    void OnTriggerEnter(Collider other){
    //        if (enabled && networkView.enabled && networkView.isMine && other.tag == "Road")
    //        {
    //            if(!carB)
    //                carB = GetComponent<CarB>();
    //            if(carB && carB.round == 3)
    //            {
    //                if(!gameState)
    //                    gameState = FindObjectOfType(typeof(PlayGameController)) as PlayGameController;
    //                if(!property)
    //                    property = GetComponent<CarProperty>();
    //                if(!carAI)
    //                    carAI = GetComponent<CarAI>();
    //                if(!isSendWin)
    //                {
    //                    if(gameState && !gameState.IsBalanceState()) {
    //                        networkView.enabled = false;
    //                        
    //                        gameState.SendWin(property.GetDriftTime(), property.GetUseEnergy(), property.GetBeHitTime(), property.ownerGUPID);
    //                        
    //                        isSendWin = true;
    //                    }
    //                    
    //                }
    //                carB.SetSteer(0);
    //                carB.SetThrottle(0);
    ////				carB.SetEnableUserInput(false);
    ////				Camera.main.GetComponent<UserInterfaceControl>().enabled = false;
    //                carB.Wait(true);
    //                carAI.enabled = false;
    //                property.SetShowRank(false);
    //            }
    //        }
    //    }
    void FinishRound()
    {
        if (enabled && networkView.enabled && networkView.isMine)
        {
            if(!gameState)
                gameState = FindObjectOfType(typeof(PlayGameController)) as PlayGameController;
            if(!property)
                property = GetComponent<CarProperty>();
            if(!carAI)
                carAI = GetComponent<CarAI>();
            if(!isSendWin)
            {
                if(gameState && !gameState.IsBalanceState()) {
                    networkView.enabled = false;

                    gameState.SendWin(property.GetDriftTime(), property.GetUseEnergy(), property.GetBeHitTime(), property.ownerGUPID);

                    isSendWin = true;
                }

            }
        //			carB.SetSteer(0);
        //			carB.SetThrottle(0);
        //				carB.SetEnableUserInput(false);
        //				Camera.main.GetComponent<UserInterfaceControl>().enabled = false;
        //			carB.Wait(true);
            carAI.enabled = false;
            property.SetShowRank(false);
        }
    }
Ejemplo n.º 5
0
 void Summer(CarProperty car)
 {
     foreach(GameObject summer in summers)
     {
         summer.SetActiveRecursively(true);
     }
 }
Ejemplo n.º 6
0
        public void AddCarWithProp()
        {
            // arrange
            clean();

            Car car = new Car();

            car.model       = "Opel";
            car.pricePerDay = 4000;
            car.properties  = new List <CarProperty>();

            CarProperty prop = new CarProperty();

            prop.description = "климат контроль";
            car.properties.Add(prop);

            // act
            controller.AddCar(car);
            var properties = controller.GetAllCarProperties();
            var cars       = controller.GetAllCars();

            // assert
            Assert.AreEqual(1, cars.Count);
            Assert.AreEqual(4000, cars[0].pricePerDay);
            Assert.AreEqual("Opel", cars[0].model);
            Assert.AreEqual("климат контроль", cars[0].properties[0].description);
            Assert.AreEqual(1, properties.Count);
            Assert.AreEqual("климат контроль", properties[0].description);
        }
Ejemplo n.º 7
0
    public override void StartAction()
    {
        //IsTimeUp = false;
        IsComplete = false;

        NowTime = TimeLimit;

        car.position = StartPoint.position;
        car.rotation = StartPoint.rotation;
        if(carb == null){
            carb = car.GetComponent<CarB>();
        }

        carb.SetStartLine(false);
        carb.ResetNowNode();
        CountDownTimer = MyGameCountDownTimer.GetComponent<GameCountDownTimer>();
        CountDownTimer.IsShowCountDown = true;
        CountDownTimer.SetNowTime(NowTime);

        property = car.GetComponent<CarProperty>();
        property.SetEnergy(0.0f);
        //		userinterfacecontrol = FindObjectOfType(typeof(UserInterfaceControl)) as UserInterfaceControl;

        //		userinterfacecontrol.SetShowCarPos(false);
        //		userinterfacecontrol.SetShowEnergy(true);
        //		userinterfacecontrol.SetShowLoop(true);
        //		userinterfacecontrol.SetShowRank(false);
        //		userinterfacecontrol.SetShowTime(false);
        //		userinterfacecontrol.SetShowSkillBg(false);
        //		for(int i = 0 ; i < 3 ; i++){
        //			userinterfacecontrol.SetShowSkill(i,false);
        //		}
        //		userinterfacecontrol.SetShowBrake(true);
    }
Ejemplo n.º 8
0
 bool IsBarrier(VictoryCondition victor)
 {
     if(playersCar == null)
     {
         playersCar = victor.targets[0].GetComponent<CarProperty>();
     }
     return (playersCar.GetBarrierTime() >= victor.times);
 }
Ejemplo n.º 9
0
Archivo: CPR.cs Proyecto: BBJV/camachi
 public override void Use(CarProperty car, int level)
 {
     base.Use(car, level);
     if(!smfCamera)
         smfCamera = Camera.main.GetComponent<SmoothFollow>();
     selfCar = car;
     StartCoroutine(CPRSpeed());
 }
Ejemplo n.º 10
0
    void obstacle(CarProperty car)
    {
        //-----------------------I added-------------------------------------------------
        //		carlevel2 = dc.carLevel;
        //groundObstacle=GameObject.Find("groundObstacle");

        //skills play level1~level5
        //Change by Vincent
        //		switch (skillLevel)
        //		{
        //			//how long the skill can play
        //			case 1:
        //				skillEffect= -40.0f;
        //				skillLiveTime = 20.0f;
        //				break;
        //			case 2:
        //				skillEffect= -40.0f;
        //				skillLiveTime = 25.0f;
        //				break;
        //			case 3:
        //				skillEffect= -20.0f;
        //				skillLiveTime = 30.0f;
        //				break;
        //			case 4:
        //				skillEffect= -25.0f;
        //				skillLiveTime = 35.0f;
        //				break;
        //			case 5:
        //				skillEffect= -30.0f;
        //				skillLiveTime = 40.0f;
        //				break;
        //		}

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

        // if skill played the car will light
        skillUsing = true;
        //Debug.LogError("OnTriggerEnterha");
        if(roadBlockAudio)
        {
            AudioSource.PlayClipAtPoint(roadBlockAudio, targetPosition.position);
        }
        WhirlObstacle newGroundObstacle = Instantiate(groundObstacle, targetPosition.position, targetPosition.rotation) as WhirlObstacle;
        if(obstacleScale != 1.0f)
        {
            newGroundObstacle.transform.localScale = newGroundObstacle.transform.localScale * obstacleScale;
            Vector3 position = newGroundObstacle.transform.position;
            position.y += obstacleScale * 0.5f;
            newGroundObstacle.transform.position = position;
        }
        newGroundObstacle.selfCar = car;

        //finish the skill after 5 seconds
        newGroundObstacle.liveTime = skillSetting[skillLevel - 1].skillEffectTimes;
        newGroundObstacle.effectPercent = skillSetting[skillLevel - 1].effectPercent;
        skillUsing = false;
    }
Ejemplo n.º 11
0
 public override void Use(CarProperty car, int level)
 {
     base.Use(car, level);
     if(cars == null || cars.Length == 0)
     {
         cars = FindObjectsOfType(typeof(CarProperty)) as CarProperty[];
     }
     StartCoroutine(SlowDownSkill(car));
 }
 public Car()
 {
     YearProperty = new CarProperty
     {
         Background = new SolidColorBrush(Colors.Transparent),
         Foreground = new SolidColorBrush(Colors.Black),
         FontWeight = FontWeights.Normal
     };
 }
Ejemplo n.º 13
0
 public void ApplyDamageHp(float damage)
 {
     if(_canDamageHp && !repair)
     {
         if(!cp)
             cp = GetComponent<CarProperty>();
     //			cp.ReduceHealthPoint(damage);
     }
 }
Ejemplo n.º 14
0
 public void ApplyDamageEnergy(float damage)
 {
     if(_canDamageEnergy && !repair)
     {
         if(!cp)
             cp = GetComponent<CarProperty>();
         cp.ReduceEnergy(damage);
     }
 }
Ejemplo n.º 15
0
    public override void Use(CarProperty car, int level)
    {
        if(!smoothFollow)
            smoothFollow = Camera.main.GetComponent<SmoothFollow>();

        if(!BigRushTurboAudio)
            BigRushTurboAudio = gameObject.AddComponent<AudioSource>();
        BigRushTurboAudio.loop = true;
        BigRushTurboAudio.clip = BigRushTurboSound;
        BigRushTurboAudio.volume = BigRushTurboAudioVolume;
        BigRushTurboAudio.pitch = BigRushTurboPitch;
        BigRushTurboAudio.Play();

        if(!BigRushGrowAudio)
            BigRushGrowAudio = gameObject.AddComponent<AudioSource>();
        BigRushGrowAudio.loop = true;
        BigRushGrowAudio.clip = BigRushGrowSound;
        BigRushGrowAudio.volume = BigRushGrowoAudioVolume;
        BigRushGrowAudio.pitch = BigRushGrowPitch;
        BigRushGrowAudio.Play();
        base.Use(car, level);

        if(colors == null || colors.Length == 0)
        {
            colors = new Color[materials.Length];
            tempMaterials = new Material[materials.Length];
            int index = 0;
            foreach(Material material in materials)
            {
                tempMaterials[index] = new Material(material);
                colors[index] = tempMaterials[index].color;
                index++;
            }
        //			materials = tempMaterials;
            index = 0;
            foreach(Material material in tempMaterials)
            {
        //				materials[index] = material;
                if(index == 0)
                {
                    foreach(Renderer render in rendererTC01)
                    {
                        render.materials[0] = material;
                    }
                }
                else if(index == 1)
                {
                    foreach(Renderer render in rendererTC02)
                    {
                        render.materials[0] = material;
                    }
                }
                index++;
            }
        }
        StartCoroutine(BiggerRush(car));
    }
Ejemplo n.º 16
0
 // Use this for initialization
 IEnumerator Start()
 {
     SmoothFollow smCamera = Camera.main.GetComponent<SmoothFollow>();
     while(!smCamera.target)
     {
         yield return null;
     }
     PlayerCar = smCamera.target;
     property = PlayerCar.GetComponent<CarProperty>();
 }
Ejemplo n.º 17
0
 IEnumerator Protect(CarProperty car)
 {
     float _time = time;
     while(_time > 0)
     {
         //car hp recover x percent for 1 second
         yield return new WaitForSeconds(1);
         _time -= 1;
     }
 }
Ejemplo n.º 18
0
    public override void Use(CarProperty car, int level)
    {
        if(!OilAudio)
            OilAudio = gameObject.AddComponent<AudioSource>();
        OilAudio.loop = true;
        OilAudio.clip = OilSound;
        OilAudio.volume = OilAudioVolume;
        OilAudio.pitch = OilPitch;

        base.Use(car, level);
        selfCar = car;
        StartCoroutine(Oil(car));
    }
Ejemplo n.º 19
0
 void ThrowObstacle(CarProperty car)
 {
     skillUsing = true;
     if(roadBlockAudio)
     {
         AudioSource.PlayClipAtPoint(roadBlockAudio, targetPosition.position);
     }
     ThrowTrack newGroundObstacle = Instantiate(groundObstacle, targetPosition.position, targetPosition.rotation) as ThrowTrack;
     newGroundObstacle.selfCar = car;
     newGroundObstacle.speed = Mathf.Clamp(rigidbody.velocity.magnitude * 1.5f, 50.0f, rigidbody.velocity.magnitude * 1.5f);
     newGroundObstacle.liveTime = skillSetting[skillLevel - 1].skillEffectTimes;
     skillUsing = false;
 }
Ejemplo n.º 20
0
Archivo: Dash.cs Proyecto: BBJV/camachi
 IEnumerator DashCar(CarProperty car)
 {
     skillUsing = true;
     speedUpSource = gameObject.AddComponent<AudioSource>();
     speedUpSource.loop = false;
     speedUpSource.clip = speedUpAudio;
     speedUpSource.Play();
     car.rigidbody.AddForce(car.transform.forward * car.rigidbody.mass * startForce);
     car.TorqueUp(speedUpPercent, skillColor);
     yield return new WaitForSeconds(effectTime);
     car.TorqueUp(0.0f, Color.white);
     Destroy(speedUpSource);
     skillUsing = false;
 }
Ejemplo n.º 21
0
 public override void Use(CarProperty car, int level)
 {
     base.Use(car, level);
     if(color == Color.black)
     {
         tempMaterial = new Material(ambulanceMaterial);
         color = tempMaterial.color;
         foreach(Renderer render in renderers)
         {
             render.materials[0] = tempMaterial;
         }
     }
     StartCoroutine(ProtectCar(car));
 }
Ejemplo n.º 22
0
 //--------------------------------------------------------------------------------
 public override void Use(CarProperty car, int level)
 {
     base.Use(car, level);
     if(!smfCamera)
         smfCamera = Camera.main.GetComponent<SmoothFollow>();
     if(cars == null || cars.Length == 0)
     {
         cars = FindObjectsOfType(typeof(CarProperty)) as CarProperty[];
     }
     if(!selfCar)
     {
         selfCar = car;
     }
     StartCoroutine(speedLimit(car));
 }
Ejemplo n.º 23
0
        public void AddCarProp()
        {
            // arrange
            clean();

            CarProperty carPr = new CarProperty();

            carPr.description = "климат контроль";

            // act
            controller.AddCarProperty(carPr);
            var props = controller.GetAllCarProperties();

            // asset
            Assert.AreEqual(1, props.Count);
            Assert.AreEqual("климат контроль", props[0].description);
        }
Ejemplo n.º 24
0
        private Preference initSomeCarsAndPref()
        {
            Car car = new Car();

            car.model       = "Opel";
            car.pricePerDay = 4000;
            car.properties  = new List <CarProperty>();
            CarProperty prop = new CarProperty();

            prop.description = "климат контроль";
            car.properties.Add(prop);
            controller.AddCar(car);

            car             = new Car();
            car.model       = "Opel";
            car.pricePerDay = 3000;
            controller.AddCar(car);

            car             = new Car();
            car.model       = "Opel";
            car.pricePerDay = 2000;
            controller.AddCar(car);

            Customer cust = new Customer();

            cust.name        = "Вася";
            cust.surname     = "Пупкин";
            cust.passport    = "1234 567890";
            cust.phoneNumber = "12345";

            Preference preference = new Preference {
            };

            preference.customerId     = controller.AddCustomer(cust);
            preference.startDate      = DateTime.Now.AddDays(1);
            preference.rentalPeriod   = 3;
            preference.maxPricePerDay = 2000;
            preference.carModel       = "Opel";
            preference.properties     = new List <CarProperty>();

            return(preference);
        }
Ejemplo n.º 25
0
        public void AddCarPropSame()
        {
            // arrange
            clean();

            CarProperty carPr1 = new CarProperty();

            carPr1.description = "подогрев сидения";
            CarProperty carPr2 = new CarProperty();

            carPr2.description = "подогрев сидения";

            // act
            controller.AddCarProperty(carPr1);
            controller.AddCarProperty(carPr2);
            var props = controller.GetAllCarProperties();

            // asset
            Assert.AreEqual(1, props.Count);
        }
Ejemplo n.º 26
0
    public override void Use(CarProperty car, int level)
    {
        if(!RushReleaseAudio)
        RushReleaseAudio = gameObject.AddComponent<AudioSource>();
        RushReleaseAudio.loop = false;
        RushReleaseAudio.clip = RushReleaseSound;
        RushReleaseAudio.volume = RushReleaseAudioVolume;
        RushReleaseAudio.pitch = RushReleasePitch;
        RushReleaseAudio.Play();

        if(!RushHornAudio)
        RushHornAudio = gameObject.AddComponent<AudioSource>();
        RushHornAudio.loop = true;
        RushHornAudio.clip = RushHornSound;
        RushHornAudio.volume = RushHornAudioVolume;
        RushHornAudio.pitch = RushHornPitch;
        //RushHornAudio.Play();
        base.Use(car, level);
        StartCoroutine(CarRush(car));
    }
Ejemplo n.º 27
0
        public void AddCarPropDif()
        {
            // arrange
            clean();

            CarProperty carPr1 = new CarProperty();

            carPr1.description = "подогрев сидения";
            CarProperty carPr2 = new CarProperty();

            carPr2.description = "климат контроль";

            // act
            controller.AddCarProperty(carPr1);
            controller.AddCarProperty(carPr2);
            var props = controller.GetAllCarProperties();

            // asset
            Assert.AreEqual(props.Count, 2);
            Assert.AreNotEqual(props[0].id, props[1].id);
        }
Ejemplo n.º 28
0
        public void FindCarProp2()
        {
            // arrange
            clean();

            CarProperty carPr1 = new CarProperty();

            carPr1.description = "подогрев сидения";
            CarProperty carPr2 = new CarProperty();

            carPr2.description = "климат контроль";

            // act
            controller.AddCarProperty(carPr1);
            controller.AddCarProperty(carPr2);
            List <String> props    = new List <string>(new String[] { "плазмовая пушка" });
            var           carProps = controller.FindCarProperties(props);

            // asset
            Assert.AreEqual(0, carProps.Count);
        }
Ejemplo n.º 29
0
    IEnumerator SlowDownSkill(CarProperty self)
    {
        skillUsing = true;
        if(slowAudio)
            AudioSource.PlayClipAtPoint(slowAudio, self.transform.position);
        try
        {
            foreach(CarProperty car in cars)
            {
                if(car != self)
                {
                    car.SpeedUp(startForce);
                    car.TorqueUp(speedDownPercent, skillColor);
                    car.SendMessage("Slowness", effectTime, SendMessageOptions.DontRequireReceiver);
                }
            }
        }
        catch
        {
            cars = FindObjectsOfType(typeof(CarProperty)) as CarProperty[];
        }

        yield return new WaitForSeconds(effectTime);
        //		try
        //		{
        //			foreach(CarProperty car in cars)
        //			{
        //				if(car != self)
        //				{
        //					car.TorqueUp(0.0f, Color.white);
        //				}
        //			}
        //		}
        //		catch
        //		{
        //			cars = FindObjectsOfType(typeof(CarProperty)) as CarProperty[];
        //		}

        skillUsing = false;
    }
Ejemplo n.º 30
0
 //    void Start () {
 //        oilMark = Instantiate(oilPrefab) as OilSpill;
 //    }
 IEnumerator Oil(CarProperty car)
 {
     if(oilNow)
         yield break;
     skillUsing = true;
     lastOilMark=-1;
     float startTime = 0.0f;
     oilNow = true;
     animation["skill"].time = 0.0f;
     animation["skill"].speed = 1.0f;
     animation.CrossFade("skill");
     yield return StartCoroutine(ShowEffect());
     OilSpill oilMark = Instantiate(oilPrefab) as OilSpill;
     oilMark.liveTime = skillSetting[skillLevel - 1].effectLiveTime;
     car.SetUnStick(true);
     while(startTime < skillSetting[skillLevel - 1].skillEffectTimes)
     {
         if(oilMark != null && !selfCar.IsAirTime())
         {
             lastOilMark=oilMark.AddOilMark(oilPosition.position,transform.up,0.02f,lastOilMark,skillSetting[skillLevel - 1].effectPercent,hit, car);
             if(!OilAudio.isPlaying)
                 OilAudio.Play();
         }
         else
         {
             lastOilMark=-1;
             OilAudio.Stop();
         }
         startTime += Time.deltaTime;
         yield return null;
     }
     oilParticle.active = false;
     animation["skill"].time = animation["skill"].length;
     animation["skill"].speed = -1.0f;
     animation.CrossFade("skill");
     car.SetUnStick(false);
     oilNow = false;
     skillUsing = false;
     OilAudio.Stop();
 }
Ejemplo n.º 31
0
    IEnumerator ProtectCar(CarProperty car)
    {
        if(inProtect)
            yield break;
        skillUsing = true;
        inProtect = true;
        //		Behaviour halo = GetComponent("Halo") as Behaviour;
        //		halo.enabled = true;
        StartCoroutine(ShowEffectAnimation(true));
        animation["skill"].time = 0.0f;
        animation["skill"].speed = 1.0f;
        animation.CrossFade("skill");

        AudioSource sirenAudio = gameObject.AddComponent<AudioSource>();
        sirenAudio.clip = ambulanceSiren;
        sirenAudio.volume = ambulanceSirenVolume;
        sirenAudio.loop = true;
        sirenAudio.Play();
        AudioSource effectAudio = gameObject.AddComponent<AudioSource>();
        effectAudio.clip = effectSound;
        effectAudio.volume = effectSoundVolume;
        effectAudio.loop = true;
        effectAudio.Play();
        car.Protect(true);
        yield return new WaitForSeconds(skillSetting[skillLevel - 1].skillEffectTimes);
        StartCoroutine(ShowEffectAnimation(false));
        car.Protect(false);
        animation["skill"].time = animation["skill"].length;
        animation["skill"].speed = -1.0f;
        animation.CrossFade("skill");
        //		StartCoroutine(ChangeColor(true));
        sirenAudio.Stop();
        Destroy(sirenAudio);
        effectAudio.Stop();
        Destroy(effectAudio);
        //		halo.enabled = false;
        inProtect = false;
        skillUsing = false;
    }
Ejemplo n.º 32
0
        public void GetAllInUseCars()
        {
            // arrange
            clean();
            Car car = new Car();

            car.model       = "Opel";
            car.pricePerDay = 4000;
            car.properties  = new List <CarProperty>();
            CarProperty prop = new CarProperty();

            prop.description = "климат контроль";
            car.properties.Add(prop);

            controller.AddCar(car);

            // act
            var cars = controller.GetAllInUseCars();

            // asset
            Assert.AreEqual(0, cars.Count);
        }
Ejemplo n.º 33
0
    //    private UserInterfaceControl userinterfacecontrol;
    public override void StartAction()
    {
        //IsTimeUp = false;
        IsComplete = false;

        //		NowTime = 0.0f;

        car.position = StartPoint.position;
        car.rotation = StartPoint.rotation;
        if(carb == null){
            carb = car.GetComponent<CarB>();
        }

        carb.SetStartLine(false);
        carb.ResetNowNode();
        property = car.GetComponent<CarProperty>();
        property.SetEnergy(1.0f);

        AICar = GameObject.FindWithTag("TrainingAICar").transform;
        AIproperty = AICar.GetComponent<CarProperty>();
        AICar.GetComponent<CarAI>().enabled = true;
        AIcarb = AICar.GetComponent<CarB>();
        AIcarb.Wait(false);

        //		userinterfacecontrol = FindObjectOfType(typeof(UserInterfaceControl)) as UserInterfaceControl;

        //		userinterfacecontrol.SetShowCarPos(false);
        //		userinterfacecontrol.SetShowEnergy(true);
        //		userinterfacecontrol.SetShowLoop(false);
        //		userinterfacecontrol.SetShowRank(true);
        //		userinterfacecontrol.SetShowTime(false);
        //		userinterfacecontrol.SetShowSkillBg(true);
        //		for(int i = 0 ; i < 3 ; i++){
        //			userinterfacecontrol.SetShowSkill(i,false);
        //		}
        //		userinterfacecontrol.SetShowSkill(0,true);
        //		userinterfacecontrol.SetShowBrake(true);
    }
Ejemplo n.º 34
0
    // Function called by the wheels that is skidding. Gathers all the information needed to
    // create the mesh later. Sets the intensity of the skidmark section b setting the alpha
    // of the vertex color.
    public int AddOilMark(Vector3 pos, Vector3 normal, float intensity, int lastIndex, float effectPercent, int hitTime, CarProperty user)
    {
        if(intensity > 1)
            intensity = 1.0f;
        if(intensity < 0)
            return -1;
        markSection curr = skidmarks[numMarks % maxMarks];
        curr.pos = pos + normal * groundOffset;
        curr.normal = normal;
        curr.intensity = intensity;
        curr.lastIndex = lastIndex;

        if(lastIndex != -1)
        {
            markSection last = skidmarks[lastIndex % maxMarks];
            Vector3 dir = (curr.pos - last.pos);
            Vector3 xDir = Vector3.Cross(dir,normal).normalized;

            curr.posl = curr.pos + xDir * markWidth * 0.5f;
            curr.posr = curr.pos - xDir * markWidth * 0.5f;
            curr.tangent = new Vector4(xDir.x, xDir.y, xDir.z, 1);

            if(last.lastIndex == -1)
            {
                last.tangent = curr.tangent;
                last.posl = curr.pos + xDir * markWidth * 0.5f;
                last.posr = curr.pos - xDir * markWidth * 0.5f;
            }
        }
        numMarks++;
        updated = true;
        percent = effectPercent;
        hit = hitTime;
        owner = user;
        return numMarks -1;
    }
Ejemplo n.º 35
0
 set => SetValue(CarProperty, value);
Ejemplo n.º 36
0
 public IResult Update(CarProperty brand)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 37
0
 public override void Use(CarProperty car, int level)
 {
     base.Use(car, level);
     Protect(car);
 }
Ejemplo n.º 38
0
 public override void Use(CarProperty car, int level)
 {
     base.Use(car, level);
     StartCoroutine(Jet());
 }
Ejemplo n.º 39
0
 // Constructor
 //    public CarAIProtoType (int index) {
 //        NextNode = 0;
 //        MyAvoidAction = AVOID_ACTION.None;
 //        Index = index;
 //    }
 void Start()
 {
     //		CarScriptInstance = GetComponent<DriftCar>();
     property = GetComponent<CarProperty>();
     //		if(CarScriptInstance)
     //			CarScriptInstance.SetEnableUserInput(false);
     CarBScript = GetComponent<CarB>();
     //		if(CarBScript)
     //			CarBScript.SetEnableUserInput(false);
     //		SetCarTransform(transform);
     ignoreLayers = 1 << 2;
     ignoreLayers = ignoreLayers | (1 << 20);
     ignoreLayers = ~ignoreLayers;
     Throttle(1.0f);
     oldPosition = transform.position;
     //		StartCoroutine(CheckNode());
     //		StartCoroutine(UseSkill());
     //		SendMessage("SetAIRandomLevel",SendMessageOptions.DontRequireReceiver);
 }
Ejemplo n.º 40
0
 IEnumerator BiggerRush(CarProperty car)
 {
     if(rush)
         yield break;
     rush = true;
     skillUsing = true;
     animation["skill"].time = 0.0f;
     animation["skill"].speed = 1.0f;
     animation.CrossFade("skill");
     StartCoroutine(ShowEffect());
     StartCoroutine(ChangeColor(false));
     car.AddSkillTime();
     car.SlowDown(false);
     car.RPMUp(skillSetting[skillLevel - 1].effectPercent);
     car.TorqueUp(skillSetting[skillLevel - 1].effectPercent, Color.white);
     car.UnCrash(true);
     boxCollider.isTrigger = false;
     //		boxCollider.transform.localPosition = Vector3.zero;
     float size = 1.0f;
     while(size < changeSize)
     {
         size += 0.1f;
         car.ChangeSize(size);
         if(smoothFollow.target == transform.root)
             smoothFollow.SendMessage("SetTarget", transform, SendMessageOptions.DontRequireReceiver);
         //smoothFollow.height = smoothFollow.height + 0.3f;
         yield return new WaitForSeconds(0.1f);
     }
     BigRushGrowAudio.Stop();
     yield return new WaitForSeconds(skillSetting[skillLevel - 1].skillEffectTimes);
     car.SlowDown(true);
     car.RPMUp(0);
     car.TorqueUp(0, Color.white);
     while(size > 1.0f)
     {
         size -= 0.1f;
         car.ChangeSize(size);
         yield return new WaitForSeconds(0.1f);
     }
     foreach(GameObject effect in speedUpEffects)
     {
         effect.active = false;
     }
     animation["skill"].time = animation["skill"].length;
     animation["skill"].speed = -1.0f;
     animation.CrossFade("skill");
     StartCoroutine(ChangeColor(true));
     car.UnCrash(false);
     boxCollider.isTrigger = true;
     //		boxCollider.transform.localPosition = new Vector3(0, -0.5f, 0);
     BigRushTurboAudio.Stop();
     rush = false;
     skillUsing = false;
     if(smoothFollow.target == transform.root)
     {
         smoothFollow.SendMessage("SetTarget", transform, SendMessageOptions.DontRequireReceiver);
     }
 }