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


C# PlayerControl.GetComponent方法代码示例

本文整理汇总了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;

	}
开发者ID:huanzheWu,项目名称:Purity-Cat-_Unity3D-Game,代码行数:12,代码来源:CamControler.cs

示例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));
    }
开发者ID:andrewhe1997,项目名称:DarkDreams,代码行数:15,代码来源:ChasingMonster.cs

示例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();
     //}
 }
开发者ID:technicalvgda,项目名称:DarkDreams,代码行数:17,代码来源:PatrollingMonster.cs

示例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));
    }
开发者ID:technicalvgda,项目名称:DarkDreams,代码行数:24,代码来源:ChasingMonster.cs

示例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();
     //}
 }
开发者ID:andrewhe1997,项目名称:DarkDreams,代码行数:13,代码来源:PatrollingMonster.cs


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