当前位置: 首页>>代码示例>>C#>>正文


C# CarController.GetComponent方法代码示例

本文整理汇总了C#中CarController.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# CarController.GetComponent方法的具体用法?C# CarController.GetComponent怎么用?C# CarController.GetComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CarController的用法示例。


在下文中一共展示了CarController.GetComponent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsPlayer

    bool IsPlayer(CarController car)
    {
        if (car == null)
            return false;

        return car.GetComponent<CarUserControlMP>() != null;
    }
开发者ID:Feinte75,项目名称:TP2_LOG4715,代码行数:7,代码来源:Accelerator.cs

示例2: CheckpointTriggered

    public void CheckpointTriggered(CarController car, int checkPointIndex)
    {
        PositionData carData = _carPositions[car];

        if (!_finished)
        {
            if (checkPointIndex == 0)
            {
                if (carData.checkPoint == _checkPointCount-1)
                {
                    carData.checkPoint = checkPointIndex;
                    carData.lap += 1;

                    // Mettre à jour le tour le plus avancé :
                    if (carData.lap > _currentMaxLap) {
                        _currentMaxLap = carData.lap;
                    }

                    if (IsPlayer(car))
                    {
                        GetComponent<RaceManager>().Announce("Tour " + (carData.lap + 1).ToString());

                        // Mec1. Style :
                        car.GetComponent<StyleManager>().logStyle(100, "Tour complet");
                    }

                    if (carData.lap >= _totalLaps)
                    {
                        _finished = true;
                        GetComponent<RaceManager>().EndRace(car.name.ToLower());

                        if (IsPlayer(car))
                        {
                            // Mec1. Style :
                            car.GetComponent<StyleManager>().logStyle(1000, "Premier !");
                        }
                    }
                }
            }
            else if (carData.checkPoint == checkPointIndex-1) //Checkpoints must be hit in order
            {
                carData.checkPoint = checkPointIndex;
            }
        }
    }
开发者ID:SeevenDev,项目名称:LOG4715_Lab2,代码行数:45,代码来源:CheckpointManager.cs

示例3: ResetCar

    public IEnumerator ResetCar(CarController car)
    {
        int count = (int)((float)_resetTimer / 0.16f + 0.5f);
        var tracker = car.GetComponent<WaypointProgressTracker>();
        car.transform.position = tracker.LastWaypoint.position;
        car.transform.rotation = tracker.LastWaypoint.rotation;

        do
        {
            yield return new WaitForSeconds (0.16f);
            car.rigidbody.velocity = Vector3.zero;
            count--;
        } while (count > 0);

        car.rigidbody.velocity = Vector3.zero;
        car.Reset();
    }
开发者ID:KaribouSpatial,项目名称:JeuDeCourse,代码行数:17,代码来源:CheckpointManager.cs

示例4: Initialize

	public void Initialize(CarController car) {
		Debug.Log ("@TODO: Replace this with new engine coefficients.");
		// car.Engine.MaxSpeed = maxSpeed;
		// car.Engine.MaxAcceleration = maxAcceleration;
		car.stopDistance = stopDistance;
		car.carColours = new List<Color> (colourOptions);

		SpriteRenderer colourizableRenderer = car.GetComponent<SpriteRenderer>();
		colourizableRenderer.sprite = colourizableSprite;
		foreach (SpriteRenderer renderer in car.GetComponentsInChildren<SpriteRenderer>()) {
			if (renderer == colourizableRenderer || renderer.GetComponent<TurnIndicator>() != null) {
				continue;
			}
			else {
				renderer.sprite = fixedColourSprite;
				break;
			}
		}
	}
开发者ID:millwardesque,项目名称:TrafficSurfer,代码行数:19,代码来源:CarData.cs

示例5: IsPlayer

 bool IsPlayer(CarController car)
 {
     return car.GetComponent<CarUserControlMP>() != null;
 }
开发者ID:GuillaumeLangis,项目名称:LOG4715,代码行数:4,代码来源:CheckpointManager.cs

示例6: Start

    private void Start()
    {
        volumeFadeIn = true;
        AudioListener.volume = 0.0f;

        // Initialize values
        pauseAnimation = false;
        pause = false;
        started = false;
        settings = false;
        isDrifting = false;
        canContinue = false;
        canDrift = true;
        canShowExtra = true;
        avoiding = false;
        pressedExit = false;
        tutorial = false;
        canAdvanceTutorial = true;
        driftTutorial = false;
        driftTutorialObjective = false;
        driftTutorialDriftDone = false;
        checkingGamepad = false;
        disabledUI = false;
        totalScore = 0;
        driftScore = 0;
        maxDriftScore = 0;
        multiplier = 0;
        challengeTextState = 0;
        tutorialState = 0;
        driftTutorialState = 0;
        playerName = "";
        previousTimeScale = Time.timeScale;
        rigidbodyVelocity = Vector3.zero;
        multiplierTemp = multiplierTempInit;
        collisionTemp = collisionTempInit;
        avoidTemp = avoidTempInit;
        initPosition = new Vector3[labelsUI.Length];
        dataManager = DataManager.Instance;
        carInput = CarInput.Instance;

        // Initialize time challenge values
        leftTime = leftTimeInit;
        timePickupsCount = timePickupRoot.transform.childCount;
        currentTimePickup = 0;

        timePickups = new GameObject[timePickupsCount];

        for(int i = 0; i < timePickups.Length; i++)
        {
            timePickups[i] = timePickupRoot.transform.GetChild (i).gameObject;
        }

        for(int i = 0; i < timePickups.Length; i++)
        {
            timePickups[i].GetComponent<DriftPickup>().DisablePickupForMinimap();
        }

        timeChallengeUI.SetActive (false);

        for(int i = 0; i < freeTutorialLabels.Length; i++)
        {
            freeTutorialCameras[i].enabled = false;
            freeTutorialLabels[i].SetActive (false);
        }

        for(int i = 0; i < challengeTutorialCameras.Length; i++)
        {
            challengeTutorialCameras[i].enabled = false;
            challengeTutorialLabels[i].SetActive (false);
        }

        // Get player references
        carController = GameObject.FindWithTag ("Player").GetComponent<CarController>();
        carEngine = carController.GetComponent<CarEngine>();
        carSetup = carController.GetComponent<CarSetup>();
        carAudio = carController.GetComponent<CarAudio>();
        carRigidbody = carController.GetComponent<Rigidbody>();
        introAnimation = GetComponent<CameraIntroAnimation>();
        settingsManager = GetComponent<SettingsManager>();
        extraTweenText = extraTween.GetComponent<Text>();
        challengeLabelTween = challengeLabel.GetComponent<TweenFontSize>();
        bloomUI = GameObject.Find ("UICamera").GetComponent<Bloom>();

        if(dataManager.isGamepad)
        {
            #if !UNITY_EDITOR
            UnityEngine.Cursor.visible = false;
            UnityEngine.Cursor.lockState = CursorLockMode.Locked;
            #endif
        }
        else
        {
            #if !UNITY_EDITOR
            UnityEngine.Cursor.visible = false;
            UnityEngine.Cursor.lockState = CursorLockMode.None;
            #endif
        }

        // Load data
        maxDriftScore = dataManager.bestDrift;
//.........这里部分代码省略.........
开发者ID:victorfisac,项目名称:DriftWorld,代码行数:101,代码来源:CarDrifting.cs

示例7: Start

    private void Start()
    {
        if(GameObject.FindWithTag ("MultiplayerManager"))
        {
            players = GameObject.FindGameObjectsWithTag("Player");
            for(int i = 0; i < players.Length; i++)
            {
                if(players[i].GetComponent<NetworkIdentity>().isLocalPlayer)
                {
                    carController = players[i].GetComponent<CarController>();
                    cameras = carController.GetComponent<CameraRig>().cameraTransform;
                    break;
                }
            }
        }
        else
        {
            carController = GameObject.FindWithTag ("Player").GetComponent<CarController>();
            cameras = carController.GetComponent<CameraRig>().cameraTransform;
        }

        dataManager = DataManager.Instance;
        musicSource = audioManager.GetComponents<AudioSource>();

        // Initialize values
        if(!carController)
        {
            GameObject.FindWithTag("Player").GetComponent<CarController>();
        }

        // Setup settings
        Invoke ("SetupSettings", 0.01f);
    }
开发者ID:victorfisac,项目名称:DriftWorld,代码行数:33,代码来源:SettingsManager.cs

示例8: StartGamePlayer

 public void StartGamePlayer()
 {
     // Get player references
     players = GameObject.FindGameObjectsWithTag("Player");
     for(int i = 0; i < players.Length; i++)
     {
         if(players[i].GetComponent<NetworkIdentity>().isLocalPlayer)
         {
             carController = players[i].GetComponent<CarController>();
             carEngine = carController.GetComponent<CarEngine>();
             carSetup = carController.GetComponent<CarSetup>();
             carAudio = carController.GetComponent<CarAudio>();
             carRigidbody = carController.GetComponent<Rigidbody>();
             carController.enabled = false;
             carEngine.enabled = true;
             // Disable car audio
             carAudio.EnableSources(0.5f);
             Debug.Log ("MultiplayerManager: player initialization complete");
             break;
         }
     }
 }
开发者ID:victorfisac,项目名称:DriftWorld,代码行数:22,代码来源:MultiplayerManager.cs

示例9: Start

    // Use this for initialization
    void Start()
    {
        shieldDome = null;
        car = transform.root.GetComponent<CarController>();
        carModel = car.GetComponent<Rigidbody>();

        explHolder = Helpers.FindOrCreateGameObject("ExplosionHolder");
    }
开发者ID:JeanPascalEvette,项目名称:DodgeThisRacing,代码行数:9,代码来源:CarHitbox.cs


注:本文中的CarController.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。