本文整理汇总了C#中Unit.GetCommander方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.GetCommander方法的具体用法?C# Unit.GetCommander怎么用?C# Unit.GetCommander使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.GetCommander方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCaptured
public virtual void OnCaptured(Unit capturer)
{
Debug.Log (capturer+" scored!");
capturer.Score();
capturer.currentObjective = null;
capturer.attackObjective = null;
capturer.GetCommander().attackObjective = null;
}
示例2: OnContestantEnter
protected override void OnContestantEnter(Unit contestant)
{
if(carrying == null && !OwnsObjective(contestant))
{
CancelInvoke();
transform.parent = contestant.transform;
transform.localPosition = new Vector3(-0.4f, -0.05f, 0.5f);
transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
contestant.currentObjective = this;
carrying = contestant;
carrying.aBase.captureIndex = 0;
captureIndex = 1;
Commander carryCommander = carrying.GetCommander();
if(carryCommander != null)
carryCommander.attackObjective = carrying.aBase;
carrying.attackObjective = carrying.aBase;
carrying.currentObjective = carrying.aBase;
carrying.OnPickupFlag();
Invoke("Reset",Time.deltaTime * 2);
}
}
示例3: IsFriendly
public bool IsFriendly(Unit other)
{
return GetCommander() == other.GetCommander();
}
示例4: OwnsObjective
/// <summary>
/// Checks to see if a Unit's team owns this objective.
/// </summary>
/// <returns>
/// TRUE if the Unit's team owns the objective, else FALSE.
/// </returns>
/// <param name='query'>
/// The Unit in question.
/// </param>
protected bool OwnsObjective(Unit query)
{
return query != null && owner != null && query.GetCommander() == owner;
}