예제 #1
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);
        CountDownTimer = MyGameCountDownTimer.GetComponent<GameCountDownTimer>();
        CountDownTimer.IsShowCountDown = true;
        CountDownTimer.SetNowTime(NowTime);
        //		userinterfacecontrol = FindObjectOfType(typeof(UserInterfaceControl)) as UserInterfaceControl;

        //		userinterfacecontrol.SetShowCarPos(false);
        //		userinterfacecontrol.SetShowEnergy(false);
        //		userinterfacecontrol.SetShowLoop(false);
        //		userinterfacecontrol.SetShowRank(false);
        //		userinterfacecontrol.SetShowTime(false);
        //		userinterfacecontrol.SetShowTime(false);
        //		for(int i = 0 ; i < 3 ; i++){
        //			userinterfacecontrol.SetShowSkill(i,false);
        //		}
        //		userinterfacecontrol.SetShowBrake(true);
    }
예제 #2
0
 public void NextStage()
 {
     ++GameCount;
     if (GameCount % 2 == 1)
     {
         GameCamp = Camp.CampA;
     }
     else
     {
         GameCamp = Camp.CampB;
     }
     if (GameCount >= 3)
     {
         MaxRound = 600;
     }
     else
     {
         MaxRound = 1200;
     }
     Round = 0;
     State = GameState.Unstart;
     CarA.LastInCollectRound = -MinGetBallRound;
     CarB.LastInCollectRound = -MinGetBallRound;
     Generator.ResetIndex();
     InitialPerson();
     DebugMode = false;
     if (FoulTimeFS != null)
     {
         byte[] data = Encoding.Default.GetBytes($"nextStage\r\n");
         FoulTimeFS.Write(data, 0, data.Length);
     }
     CarA.SaveCnt();
     CarB.SaveCnt();
 }
예제 #3
0
    // Update is called once per frame
    public override void Update()
    {
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }
        if(IsComplete){
            carb.SetReverseSound(false);
            return;
        }
        if(carb.IsCarReverse()){
            ReverseTime += Time.deltaTime;

            if(ReverseTime >= ReverseTimeNeed){
                IsComplete = true;
                NextState = State.Success;

                return;
            }
        }else{
            ReverseTime = 0.0f;
        }

        NowTime -= Time.deltaTime;
        NowTime = Mathf.Clamp(NowTime,0.0f,TimeLimit);
        CountDownTimer.SetNowTime(NowTime);
        if(NowTime <= 0.0f){
            IsComplete = true;
            NextState = State.Fail;
            return;
            //IsTimeUp = true;
            //IsStart = false;
        }
    }
예제 #4
0
 public void Pause() //暂停比赛
 {
     State = GameState.Pause;
     CarA.LastInCollectRound = -MinGetBallRound;
     CarB.LastInCollectRound = -MinGetBallRound;
     //CarA.HaveBall = false;
     //CarB.HaveBall = false;
     CarA.Stop();
     CarB.Stop();
 }
예제 #5
0
 public void Start() //开始比赛
 {
     State = GameState.Normal;
     CarA.LastInCollectRound = -MinGetBallRound;
     CarB.LastInCollectRound = -MinGetBallRound;
     CarA.HaveBall           = false;
     CarB.HaveBall           = false;
     CarA.Start();
     CarB.Start();
 }
예제 #6
0
        //复位
        public void AskPause(Camp c)
        {
            Pause();
            Round -= 50;
            if (Round < 0)
            {
                Round = 0;
            }
            bool Aget = false, Bget = false;

            switch (c)
            {
            case Camp.CampA:
                Bget = true;
                ++APauseNum;
                break;

            case Camp.CampB:
                Aget = true;
                ++BPauseNum;
                break;
            }
            if (CarA.People != null)
            {
                int currNum = CarA.People.Number;
                if (Aget)
                {
                    int s = (CarA.People.Score() > BPauseNum * 50) ? CarA.People.Score() : BPauseNum * 50;
                    addScore(Camp.CampA, s);
                }
                CarA.FinishCarry(false);
                NewPassenger(currNum);
            }
            else if (Aget)
            {
                addScore(Camp.CampA, BPauseNum * 50);
            }

            if (CarB.People != null)
            {
                int currNum = CarB.People.Number;
                if (Bget)
                {
                    int s = (CarB.People.Score() > APauseNum * 50) ? CarB.People.Score() : APauseNum * 50;
                    addScore(Camp.CampB, s);
                }
                CarB.FinishCarry(false);
                NewPassenger(currNum);
            }
            else if (Bget)
            {
                addScore(Camp.CampB, APauseNum * 50);
            }
        }
예제 #7
0
        public void Update()//每回合执行
        {
            if (state == GameState.Normal)
            {
                Round++;
                //GetInfoFromCameraAndUpdate();
                CheckPassengerNumber();
                #region PunishmentPhase
                //if (!CarDotValid(CarA.Pos)) CarA.Stop();
                //if (!CarDotValid(CarB.Pos)) CarB.Stop();
                #endregion

                //上车
                for (int i = 0; i != CurrPassengerNumber; ++i)
                {
                    Passenger p = Passengers[i];
                    if (p.Owner != Camp.None)
                    {
                        continue;                       //已经上车了
                    }
                    if (CarA.UnderStop == false && CarA.People == null && GetDistance(p.StartDestPos.StartPos, CarA.Pos) < MinCarryDistance)
                    {
                        CarA.StartCarry(p);
                        p.Owner = Camp.CampA;
                    }

                    else if (CarB.UnderStop == false && CarB.People == null && GetDistance(p.StartDestPos.StartPos, CarB.Pos) < MinCarryDistance)
                    {
                        CarB.StartCarry(p);
                        p.Owner = Camp.CampB;
                    }
                }
                //下车
                if (CarA.People != null && GetDistance(CarA.People.StartDestPos.DestPos, CarA.Pos) < MinCarryDistance)
                {
                    int currNum = CarA.People.Number;
                    CarA.FinishCarry();
                    NewPassenger(currNum);
                }
                if (CarB.People != null && GetDistance(CarB.People.StartDestPos.DestPos, CarB.Pos) < MinCarryDistance)
                {
                    int currNum = CarB.People.Number;
                    CarB.FinishCarry();
                    NewPassenger(currNum);
                }
                if ((Round >= 1200 && DebugMode == false) || (Round >= 1000000 && DebugMode == true)) //结束比赛
                {
                    End();
                }
            }
            //byte[] message = PackMessage();
            //SendMessage
        }
예제 #8
0
파일: Mission.cs 프로젝트: BBJV/camachi
 bool IsFinishLap(VictoryCondition victor)
 {
     if(!playersLap && !playersLapB)
     {
         playersLap = victor.targets[0].GetComponent<DriftCar>();
         playersLapB = victor.targets[0].GetComponent<CarB>();
     }
     if(playersLap)
         return (playersLap.round == victor.times);
     else
         return (playersLapB.round == victor.times);
 }
예제 #9
0
 // Use this for initialization
 IEnumerator Start()
 {
     SmoothFollow smCamera = Camera.main.GetComponent<SmoothFollow>();
     while(!smCamera.target)
     {
         yield return null;
     }
     RankLabel = transform.GetComponent<UILabel>();
     PlayerCar = smCamera.target;
     carB = PlayerCar.GetComponent<CarB>();
     NowLoopNum = carB.GetRound();
 }
예제 #10
0
    // Update is called once per frame
    public override void Update()
    {
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }
        if(IsComplete){
            return;
        }

        /*if(IsEnterCurve){
            if(!carb.IsCarDrift()){
                IsComplete = true;
                NextState = State.Fail;
                return;
            }
            if(EndTriggerPlane.GetTrig() != -1){
                IsComplete = true;
                NextState = State.Success;
                return;
            }
        }else{
            if(StartTriggerPlane.GetTrig() != -1){
                //print("IsEnterCurve = true;");
                IsEnterCurve = true;
            }
        }*/
        if(property.CheckEnergy() >= 3.0f){
            IsComplete = true;
            NextState = State.Success;
        }

        if(carb.GetRound() >= 1){
            IsComplete = true;
            NextState = State.Fail;
        }
        NowTime -= Time.deltaTime;
        NowTime = Mathf.Clamp(NowTime,0.0f,TimeLimit);
        CountDownTimer.SetNowTime(NowTime);
        if(NowTime <= 0.0f){
            IsComplete = true;
            NextState = State.Fail;

        }
    }
예제 #11
0
        //复位
        public void AskPause(Camp c)
        {
            Pause();
            CarA.HaveBall = false;
            CarB.HaveBall = false;
            CarA.LoadCnt();
            CarB.LoadCnt();
            Round = 0;
            switch (c)
            {
            case Camp.CampA:
                ++APauseNum;
                AddScore(Camp.CampA, Score.PauseScore);
                break;

            case Camp.CampB:
                ++BPauseNum;
                AddScore(Camp.CampB, Score.PauseScore);
                break;
            }
        }
예제 #12
0
    // Update is called once per frame
    public override void Update()
    {
        if(IsComplete){

            return;
        }
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }

        NowTime -= Time.deltaTime;
        NowTime = Mathf.Clamp(NowTime,0.0f,CountDownSecs);
        if(NowTime <= 0.0f){
            NowTime = 0.0f;
            IsComplete = true;
            carb.Wait(false);
            //IsTimeUp = true;
            //IsStart = false;
        }
    }
예제 #13
0
 // Use this for initialization
 IEnumerator Start()
 {
     SmoothFollow smCamera = Camera.main.GetComponent<SmoothFollow>();
     while(!smCamera.target)
     {
         yield return null;
     }
     PlayerCar = smCamera.target.GetComponent<CarB>();
     BarSpeed = PlayerCar.gearSpeeds[PlayerCar.gearSpeeds.Length - 1] / NormalSpeedBar.Length;
     SetAllSpeedBarOff();
     NowTime = 0.0f;
     CommonTime = 0.0f;
     if(TimeMin){
         TimeMin.spriteName = TimeUIString[0];
     }
     if(TimeSec10){
         TimeMin.spriteName = TimeUIString[0];
     }
     if(TimeSec1){
         TimeSec1.spriteName = TimeUIString[0];
     }
 }
예제 #14
0
        private void initializeSimulationInstances()
        {
            Vehicle carA = new CarA(seedGenerator);
            Vehicle carB = new CarB(seedGenerator);
            Vehicle carC = new CarC(seedGenerator);
            Vehicle carD = new CarD(seedGenerator);
            Vehicle carE = new CarE(seedGenerator);

            simulationA = new SimulationVariantA(maxTime, replications, backgroundWorker1, seedGenerator);
            simulationA.initCars(carA, carB, carC, carD);
            Event initialEventA = new EventVehiclesInit(simulationA, 0, simulationA.getCarsInitial());

            simulationA.init = initialEventA;

            simulationB = new SimulationVariantB(maxTime, replications, backgroundWorker1, seedGenerator);
            simulationB.initCars(carA, carC, carE);
            Event initialEventB = new EventVehiclesInit(simulationB, 0, simulationB.getCarsInitial());

            simulationB.init = initialEventB;

            simulationC = new SimulationVariantC(maxTime, replications, backgroundWorker1, seedGenerator);
            simulationC.initCars(carB, carC, carD);
            Event initialEventC = new EventVehiclesInit(simulationC, 0, simulationC.getCarsInitial());

            simulationC.init = initialEventC;

            if (variant == 1)
            {
                simulationA.isVisualized = isChecked;
            }
            else if (variant == 2)
            {
                simulationB.isVisualized = isChecked;
            }
            else if (variant == 3)
            {
                simulationC.isVisualized = isChecked;
            }
        }
예제 #15
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);
    }
예제 #16
0
 public void nextStage()
 {
     ++GameCount;
     if (GameCount >= 3)
     {
         MaxRound = 600;
     }
     else
     {
         MaxRound = 1200;
     }
     CarA.FinishCarry(false);
     CarB.FinishCarry(false);
     Round = 0;
     state = GameState.Unstart;
     InitialPassenger(100);
     DebugMode = false;
     if (FoulTimeFS != null)
     {
         byte[] data = Encoding.Default.GetBytes($"nextStage\r\n");
         FoulTimeFS.Write(data, 0, data.Length);
     }
 }
예제 #17
0
파일: RankManager.cs 프로젝트: BBJV/camachi
 public CarState(CarB car)
 {
     carBBody = car;
     property = car.GetComponent<CarProperty>();
     name = ((Definition.eCarID)property.carID).ToString();
 }
예제 #18
0
 public void Pause() //暂停比赛
 {
     state = GameState.Pause;
     CarA.Stop();
     CarB.Stop();
 }
예제 #19
0
 public void Start() //开始比赛
 {
     state = GameState.Normal;
     CarA.Start();
     CarB.Start();
 }
예제 #20
0
    public override void Update()
    {
        if(IsComplete){
            return;
        }
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }

        carb.Wait(true);
        carb.SetThrottle(0.0f);
        carb.SetSteer(0.0f);
        car.transform.rigidbody.useGravity = false;
        car.transform.rigidbody.isKinematic = true;
        car.position = StartPoint.position;
        car.rotation = StartPoint.rotation;

        if(Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
            foreach (Touch touch in Input.touches) {
                    if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
                    {
                        MessageIndex++;
                    }
            }
        }
        else
        {
            if(Input.GetMouseButtonDown(0)){
                MessageIndex++;
            }
        }
        //print("MessageIndex = "+MessageIndex);
        if(MessageIndex >= Board[SelectLan].GetBoard().Length){
            MessageIndex = Board[SelectLan].GetBoard().Length - 1;
            IsComplete = true;
            car.transform.rigidbody.isKinematic = false;
            car.transform.rigidbody.useGravity = true;

        }
    }
예제 #21
0
 //    private bool isSetting = false;
 private IEnumerator SettingTarget()
 {
     while(!smCamera.target)
     {
         yield return null;
     }
     carb = smCamera.target.GetComponent<CarB>();
     property = smCamera.target.GetComponent<CarProperty>();
     //		timer = smCamera.target.GetComponent<Timer>();
     //		isSetting = true;
     //sliderTexture = GetComponent<GUITexture>();
     //sliderTexture.color = sliderTextureliderColor;
     //		backgroundTexture.color = sliderColor;
     //		brakeTexture.color = brakeColor;
     //		brakeRect = brakeTexture.pixelInset;
     //		skillRect = skillTexture.pixelInset;
     //oriRect = sliderTexture.pixelInset;
     //guiTouchOffset.x = sliderTexture.pixelInset.width * 0.5f;
     //guiTouchOffset.y = sliderTexture.pixelInset.height * 0.5f;
     //		minLimit = backgroundTexture.pixelInset.x + guiTouchOffset.x;
     //		maxLimit = backgroundTexture.pixelInset.x + backgroundTexture.pixelInset.width - guiTouchOffset.x;
     if(Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
     {
         steerfactor = 0.2f;
     }else{
         steerfactor = 0.5f;
     }
     //		autosteerfactor = steerfactor * 2.0f;
     //		CalculateCoordinate();
     //OnGUI type
     //		skillRect = property.GetSkillRect();
     //		skillRect.y = Screen.height - skillRect.y - skillRect.height;
     startControl = true;
     //		StartCoroutine(StartControl());
 }
예제 #22
0
파일: AutoCar.cs 프로젝트: BBJV/camachi
 void Start()
 {
     //		controller = GetComponent<CharacterController>();
     //		boxCollider = GetComponent<BoxCollider>();
     carB = GetComponent<CarB>();
     carB.enabled = false;
     if(carB)
     {
         carB.enabled = false;
         WheelCollider[] wheels = GetComponentsInChildren<WheelCollider>();
         foreach(WheelCollider w in wheels)
         {
             Destroy(w.gameObject);
         }
     }
     if(!rigidbody)
     {
         Rigidbody rigid = gameObject.AddComponent<Rigidbody>();
         rigid.mass = 1500;
         rigid.angularDrag = 1000;
     }
     frontWheels = carSettings.frontWheels;
     rearWheels = carSettings.rearWheels;
     SetupWheelColliders();
     //		character = gameObject.AddComponent<CharacterController>();
     //		character.height = 1.0f;
     //		character.center = new Vector3(0, centerY, 0);
     //		CharacterController cc = GetComponent<CharacterController>();
     //		cc.detectCollisions = false;
     //		carB = transform.root.GetComponent<CarB>();
     //		controller.enabled = true;
     //		boxCollider.enabled = false;
 }
예제 #23
0
파일: CarProperty.cs 프로젝트: BBJV/camachi
    void Start()
    {
        car = GetComponent<DriftCar>();
        carB = GetComponent<CarB>();
        carAI = GetComponent<CarAI>();
        SMCamera = Camera.main.GetComponent<SmoothFollow>();
        //		if(networkView.enabled)
        //		{
        //			MatchArenaState mas = FindObjectOfType(typeof(MatchArenaState)) as MatchArenaState;
        //			tvcMatchRoom = mas.GetTvCMatchRoom();
        //		}
        if(!rank)
        {
            rank = FindObjectOfType(typeof(RankManager)) as RankManager;
        }
        defaultScale = transform.localScale;
        if(car)
            oriGrip = car.handlingTendency;
        if(rearWheels.Length > 0)
        {
            stickWheels = new StickData[rearWheels.Length];
            int i = 0;
            foreach(Transform wheel in rearWheels)
            {
                stickWheels[i] = new StickData(wheel);
                i++;
            }
        }

        /*SkillIcon[0] = levelTwo.GetIcon()[0];
        SkillIcon = levelTwo.GetIcon()[1];
        SkillIcon[2][0] = levelThree.GetIcon()[0];
        SkillIcon[2][1] = levelThree.GetIcon()[1];*/
        //		while(true)
        //		{
        //			AddEnergy(energyRate);
        //			yield return new WaitForSeconds(1);
        //		}
        skillProbabilitys = new SkillProbability[4];
        for(int i = 0; i < 4; i++)
        {
            skillProbabilitys[i] = new SkillProbability();
        //			skillProbabilitys[i].AddProbability(levelOne.Probability(i));
        //			skillProbabilitys[i].AddProbability(levelTwo.Probability(i));
        //			skillProbabilitys[i].AddProbability(levelThree.Probability(i));
            foreach(Skill skill in skills)
            {
                skillProbabilitys[i].AddProbability(skill.Probability(i));
            }
        }
        //		skillRect = new Rect((Screen.width - (levelOne.SkillIcon.width * resolutionScale.x)) * 0.5f, levelOne.SkillIcon.height * resolutionScale.y, levelOne.SkillIcon.width * resolutionScale.x, levelOne.SkillIcon.height * resolutionScale.y);
        skillRect = new Rect((Screen.width - (skills[0].SkillIcon.width * resolutionScale.x)) * 0.5f, skills[0].SkillIcon.height * resolutionScale.y, skills[0].SkillIcon.width * resolutionScale.x, skills[0].SkillIcon.height * resolutionScale.y);
    }
예제 #24
0
파일: DriftCourse.cs 프로젝트: BBJV/camachi
    // Update is called once per frame
    public override void Update()
    {
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }
        if(IsComplete){
            return;
        }
        if(ShowTurnSign){
            ShowTurnTime += Time.deltaTime;
            if(ShowTurnTime >= ShowTurnTimeLimit){
                ShowTurnSign = false;
            }
        }else{
            if(TurnSignTriggerPlane.GetTrig() != -1){
                ShowTurnSign = true;
            }
        }
        if(IsEnterCurve){
            if(!carb.IsCarDrift()){
                IsComplete = true;
                NextState = State.Fail;
                ShowTurnSign = false;
                return;
            }
            if(EndTriggerPlane.GetTrig() != -1){
                IsComplete = true;
                NextState = State.Success;
                ShowTurnSign = false;
                return;
            }
        }else{
            if(StartTriggerPlane.GetTrig() != -1){
                //print("IsEnterCurve = true;");
                IsEnterCurve = true;
            }
        }

        NowTime -= Time.deltaTime;
        NowTime = Mathf.Clamp(NowTime,0.0f,TimeLimit);
        CountDownTimer.SetNowTime(NowTime);
        if(NowTime <= 0.0f){
            IsComplete = true;
            NextState = State.Fail;
            ShowTurnSign = false;
            //IsTimeUp = true;
            //IsStart = false;
        }
    }
예제 #25
0
    // Create the needed AudioSources
    void Awake()
    {
        car = transform.GetComponent<CarB>();
        engineAudio = gameObject.AddComponent<AudioSource>();
        engineAudio.loop = true;
        engineAudio.playOnAwake = true;
        engineAudio.clip = engineSound;
        engineAudio.volume = 0.0f;

        ReverseAudio = gameObject.AddComponent<AudioSource>();
        ReverseAudio.loop = true;
        ReverseAudio.playOnAwake = false;
        ReverseAudio.clip = ReverseSound;
        ReverseAudio.volume = ReverseAudioVolume;
        ReverseAudio.pitch = ReversePitch;

        CollisionAudio = gameObject.AddComponent<AudioSource>();
        CollisionAudio.loop = false;
        CollisionAudio.playOnAwake = false;
        CollisionAudio.clip = CollisionSound;
        CollisionAudio.volume = CollisionAudioVolume;
        CollisionAudio.pitch = CollisionPitch;

        JumpCollisionAudio = gameObject.AddComponent<AudioSource>();
        JumpCollisionAudio.loop = false;
        JumpCollisionAudio.playOnAwake = false;
        JumpCollisionAudio.clip = JumpCollisionSound;
        JumpCollisionAudio.volume = JumpCollisionAudioVolume;
        JumpCollisionAudio.pitch = JumpCollisionPitch;

        skidAudio = gameObject.AddComponent<AudioSource>();
        skidAudio.loop = false;
        skidAudio.playOnAwake = false;
        skidAudio.clip = skidSound;
        skidAudio.volume = SkdAudioVolume;
        skidAudio.pitch = SkidPitch;

        EngineStartAudio = gameObject.AddComponent<AudioSource>();
        EngineStartAudio.loop = false;
        EngineStartAudio.playOnAwake = false;
        EngineStartAudio.clip = EngineStartSound;
        EngineStartAudio.volume = EngineStartAudioVolume;
        EngineStartAudio.pitch = EngineStartPitch;

        carAudio = gameObject.AddComponent<AudioSource>();
        carAudio.loop = false;
        carAudio.playOnAwake = false;
        carAudio.Stop();

        /*
        crashTime = Mathf.Max(crashLowSpeedSound.length, crashHighSpeedSound.length);
        soundsSet = false;

        idleFadeSpeedDiff = idleFadeStopSpeed - idleFadeStartSpeed;
        speedFadeSpeedDiff = speedFadeStopSpeed - speedFadeStartSpeed;
        */
    }
예제 #26
0
    // Update is called once per frame
    public override void Update()
    {
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }
        if(IsComplete){
            return;
        }

        /*if(IsEnterCurve){
            if(!carb.IsCarDrift()){
                IsComplete = true;
                NextState = State.Fail;
                return;
            }
            if(EndTriggerPlane.GetTrig() != -1){
                IsComplete = true;
                NextState = State.Success;
                return;
            }
        }else{
            if(StartTriggerPlane.GetTrig() != -1){
                //print("IsEnterCurve = true;");
                IsEnterCurve = true;
            }
        }*/
        if(AIproperty.CheckSpeedLimit()){
            IsComplete = true;
            NextState = State.Success;

        }
        if(carb.GetRound() >= 1 || AIcarb.GetRound() >= 1){
            IsComplete = true;
            NextState = State.Fail;

        }
        /*NowTime += Time.deltaTime;
        NowTime = Mathf.Clamp(NowTime,0.0f,TimeLimit);
        if(NowTime >= TimeLimit){
            IsComplete = true;
            NextState = State.Fail;
        }*/
    }
예제 #27
0
파일: CarAI.cs 프로젝트: BBJV/camachi
 // 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);
 }
예제 #28
0
파일: RaceCourse.cs 프로젝트: BBJV/camachi
    // Update is called once per frame
    public override void Update()
    {
        if(carb == null){
            carb = car.GetComponent<CarB>();
            return;
        }
        if(IsComplete){
            return;
        }

        /*if(IsEnterCurve){
            if(!carb.IsCarDrift()){
                IsComplete = true;
                NextState = State.Fail;
                return;
            }
            if(EndTriggerPlane.GetTrig() != -1){
                IsComplete = true;
                NextState = State.Success;
                return;
            }
        }else{
            if(StartTriggerPlane.GetTrig() != -1){
                //print("IsEnterCurve = true;");
                IsEnterCurve = true;
            }
        }
        print("AIcarb.GetRound() = " +AIcarb.GetRound());
        print("carb.GetStartLine = " +carb.GetStartLine());
        print("carb.GetRound = " +carb.GetRound());
        print("carb.GetWeights = " +carb.GetWeights());*/
        if(AIcarb.GetRound() > LapLimit){
            IsComplete = true;
                NextState = State.Fail;
        }
        if(carb.GetRound() > LapLimit){
            if(property.GetRank() == 1){
                IsComplete = true;
                NextState = State.Success;

            }else{
                IsComplete = true;
                NextState = State.Fail;

            }
        }
        /*NowTime += Time.deltaTime;
        NowTime = Mathf.Clamp(NowTime,0.0f,TimeLimit);
        if(NowTime >= TimeLimit){
            IsComplete = true;
            NextState = State.Fail;
        }*/
    }