本文整理汇总了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");
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}