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


C# Spaceship.GetComponent方法代码示例

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


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

示例1: Formation

    public Formation(Spaceship ship, float range)
    {
        this.ship = ship;
        rig = ship.GetComponent<Rigidbody>();
        this.range = range;
        actual = Manouver.Rotate;

        nextAction = Random.Range(range / 2, 3 * range / 4);
    }
开发者ID:Failender,项目名称:Spaceship,代码行数:9,代码来源:Formation.cs

示例2: Start

    // Use this for initialization
    IEnumerator Start()
    {
        spaceship = GetComponent<Spaceship>();

        while(true) {
            spaceship.Shot(transform);
            spaceship.GetComponent<AudioSource>().Play();
            yield return new WaitForSeconds(spaceship.shotDelay);
        }
    }
开发者ID:oyukin,项目名称:unity,代码行数:11,代码来源:Player.cs

示例3: HandleSpawnWait

	private static IEnumerator HandleSpawnWait(Spaceship spaceship) {
		SpaceshipMatchData matchData = spaceship.GetComponent<SpaceshipMatchData>();
		SpaceshipControl controls = spaceship.GetComponent<SpaceshipControl>();
		Collider collider = spaceship.GetComponent<Collider>();
	
		matchData.spawnTimeRemaining = normalSpawnWait;

		spaceship.isVisible = false;
		spaceship.controlsEnabled = false;
		
//		instance.networkView.RPC("SetVisibility", RPCMode.All, false); 
		
//		spaceship.spaceshipModelRoot.gameObject.SetActive(instance.isVisible);
//		controls.enabled = instance.isVisible;
//		collider.enabled = instance.isVisible;

		while (matchData.spawnTimeRemaining > 0.0f) {
			yield return null;
			matchData.spawnTimeRemaining = Mathf.Max(0.0f, matchData.spawnTimeRemaining-Time.deltaTime);
		}

		spaceship.transform.position = spawnPoints[lastCheckpointID].transform.position;
		spaceship.transform.rotation = spawnPoints[lastCheckpointID].transform.rotation;

//		instance.networkView.RPC("SetVisibility", RPCMode.All, true); 
		
//		spaceship.spaceshipModelRoot.gameObject.SetActive(instance.isVisible);
//		controls.enabled = instance.isVisible;
//		collider.enabled = instance.isVisible;
		SpaceshipHealth healthComponent = spaceship.GetComponent<SpaceshipHealth>();
		healthComponent.currentHealth = healthComponent.maxHealth;
		spaceship.isVisible = true;
		spaceship.controlsEnabled = true;

		Debug.Log ("Spawning '" + spaceship + "' at SpawnPoint " + lastCheckpointID + "!");
	}
开发者ID:darajad,项目名称:Lethal-Pursuit,代码行数:36,代码来源:SpawnManager.cs

示例4: OnPickup

	public override void OnPickup(Spaceship spaceship) {
		base.OnPickup(spaceship);
		SpaceshipHealth health = spaceship.GetComponent<SpaceshipHealth>();
		health.currentHealth = Mathf.Min(health.currentHealth+healthAmount, health.maxHealth);
	}
开发者ID:darajad,项目名称:Lethal-Pursuit,代码行数:5,代码来源:PickupHealth.cs


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