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


C# Agent.GetComponent方法代码示例

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


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

示例1: Activate

 public void Activate(Agent agent)
 {
     currentAgent = agent;
     AgentRigidbody = currentAgent.GetComponent<Rigidbody2D>();
     AgentAnimator = currentAgent.GetComponent<Animator>();
     Debug.Log("Idle State");
 }
开发者ID:GikeyMe,项目名称:2D-Platformer,代码行数:7,代码来源:IdleState.cs

示例2: Activate

 public void Activate(Agent agent)
 {
     currentAgent = agent;
     AgentRigidbody = currentAgent.GetComponent<Rigidbody2D>();
     AgentAnimator = currentAgent.GetComponent<Animator>();
     player = GameObject.Find("Player");
     Debug.Log("Ranged State");
 }
开发者ID:GikeyMe,项目名称:2D-Platformer,代码行数:8,代码来源:RangedAttackState.cs

示例3: Activate

 public void Activate(Agent agent)
 {
     Debug.Log("PhaseChangeState");
     currentAgent = agent;
     AgentRigidbody = currentAgent.GetComponent<Rigidbody2D>();
     AgentAnimator = currentAgent.GetComponent<Animator>();
     if (currentAgent is Boss || currentAgent is BossThree)
         AgentAnimator.SetBool("Throwing", false);
 }
开发者ID:GikeyMe,项目名称:2D-Platformer,代码行数:9,代码来源:PhaseChangeState.cs

示例4: Activate

 public void Activate(Agent agent)
 {
     currentAgent = agent;
     AgentRigidbody = currentAgent.GetComponent<Rigidbody2D>();
     AgentAnimator = currentAgent.GetComponent<Animator>();
     player = GameObject.Find("Player");
     Debug.Log("Melee State");
     if (currentAgent is Boss || currentAgent is BossThree)
         AgentAnimator.SetBool("Throwing", false);
 }
开发者ID:GikeyMe,项目名称:2D-Platformer,代码行数:10,代码来源:MeleeAttackState.cs

示例5: Activate

 public void Activate(Agent agent)
 {
     currentAgent = agent;
     AgentRigidbody = currentAgent.GetComponent<Rigidbody2D>();
     AgentAnimator = currentAgent.GetComponent<Animator>();
     player = GameObject.Find("Player");
     powerups = GameObject.FindGameObjectsWithTag("BlueDiamond");
     Debug.Log("Seek Power State");
     if (currentAgent is Boss || currentAgent is BossThree)
         AgentAnimator.SetBool("Throwing", false);
 }
开发者ID:GikeyMe,项目名称:2D-Platformer,代码行数:11,代码来源:SeekPowerState.cs

示例6: CanHitAgent

    private bool CanHitAgent(Agent targetAgent)
    {
        if (targetAgent == null)
        {
            return false;
        }

        Vector2 delta = (targetAgent.Position - _agent.Position);

        // Is it within range?
        if (delta.magnitude > fireDistance)
        {
            return false;
        }

        delta = delta.normalized;
        RaycastHit2D hit = Physics2D.Raycast(_agent.Position + delta * (Agent.AgentRadius + 0.2f), delta, fireDistance, _agent.enemies | Level.Instance.buildings);
        if (hit.collider != targetAgent.GetComponent<Collider2D>())
        {
            return false;
        }
        return true;
    }
开发者ID:mfagerlund,项目名称:LD33,代码行数:23,代码来源:Weapon.cs


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