本文整理汇总了C#中PlayerControl.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerControl.GetComponent方法的具体用法?C# PlayerControl.GetComponent怎么用?C# PlayerControl.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerControl
的用法示例。
在下文中一共展示了PlayerControl.GetComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start () {
deadline = GameObject.Find("collider_outOfView_dead");
player = GameObject.Find("Player").GetComponent<PlayerControl>(); //获取主角的脚本
Playervelocity = player.GetComponent<Rigidbody2D>();
finshgame = this.GetComponent<finshGame>();
camTransform = this.transform; //获取摄像机Transform //初始化摄像机速度
isPlayerOnCenter = false;
}
示例2: Start
// Use this for initialization
void Start()
{
//spottedCue.SetActive(false);
//set player to the object with tag "Player"
player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>();
playerPos = player.GetComponent<Transform>();
//set lineOfSight to this objects LineRenderer component
lineOfSight = GetComponent<LineRenderer>();
//set position of end node of line renderer to the same distance as its line cast
lineOfSight.SetPosition(1, new Vector3(lineCastDistance, 0, 0));
}
示例3: Start
// Use this for initialization
void Start()
{
audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent<AudioHandlerScript>();
sfx = this.GetComponent<AudioSource>();
//set volume to player's setting
sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX");
//Grab the spawner and get its script component
//obj = GameObject.Find("PatrollingEnemySpawner").GetComponent<PatrollingMonsterSpawner> ();
player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>();
playerPos = player.GetComponent<Transform>();
//If the spawner is facing left...
//if (!obj.facingRight)
//{ //then flip the monsters it spawns to go left
// FlipEnemy();
//}
}
示例4: Start
//GameObject spottedCue;
// Use this for initialization
void Start()
{
anim = GetComponent<Animator>();
audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent<AudioHandlerScript>();
sfx = this.GetComponent<AudioSource>();
//set volume to player's setting
sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX");
speedNormal = speedNormalDefault;
speedChasing = speedChasingDefault;
//transform.GetComponent<Collider2D>().attachedRigidbody.AddForce(0, 0);
//spottedCue.SetActive(false);
//set player to the object with tag "Player"
player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>();
playerPos = player.GetComponent<Transform>();
//set lineOfSight to this objects LineRenderer component
lineOfSight = GetComponent<LineRenderer>();
//set position of end node of line renderer to the same distance as its line cast
lineOfSight.SetPosition(1, new Vector3(lineCastDistance, 0, 0));
}
示例5: Start
// Use this for initialization
void Start()
{
//Grab the spawner and get its script component
//obj = GameObject.Find("PatrollingEnemySpawner").GetComponent<PatrollingMonsterSpawner> ();
player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>();
playerPos = player.GetComponent<Transform>();
//If the spawner is facing left...
//if (!obj.facingRight)
//{ //then flip the monsters it spawns to go left
// FlipEnemy();
//}
}