本文整理匯總了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;
}