本文整理汇总了C#中LayerMask.AddToMask方法的典型用法代码示例。如果您正苦于以下问题:C# LayerMask.AddToMask方法的具体用法?C# LayerMask.AddToMask怎么用?C# LayerMask.AddToMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerMask
的用法示例。
在下文中一共展示了LayerMask.AddToMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onTarget
public override void onTarget()
{
Vector2 target2 = getTarget ();
Vector3 target = new Vector3(target2.x,0,target2.y);
path = grid.findPath (this.getLegs().transform.position,target);
if (path != null)
{
current = path.First;
LayerMask mask = new LayerMask();
mask.AddToMask("Buildings");
while(current != null && !Physics.Linecast(getLegs().transform.position, current.Value.toVector3()))
{
//Debug.Log("BLAH");
//Debug.DrawLine(getLegs().transform.position, current.Value.toVector3(), Color.green);
current = current.Next;
}
} else {
current = null;
}
}
示例2: _getDesiredVelocity
public override Vector2 _getDesiredVelocity()
{
onTarget ();
if (current == null)
{
//Debug.Log ("Using aux steering!");
auxiliarySteering.setTarget(this.getTarget());
return auxiliarySteering.getDesiredVelocity();
}
if (grid.gridSquareFromVector3(this.getLegs ().transform.position) == current.Value) {
if (current.Next == null) {
current = null;
this.setInternalWeight(1.0f);
return Vector2.zero;
}
current = current.Next;
LayerMask mask = new LayerMask();
mask.AddToMask("Buildings");
while(current != null && !Physics.Linecast(getLegs().transform.position, current.Value.toVector3()))
{
if (current.Next == null) {
current = null;
this.setInternalWeight(1.0f);
return Vector2.zero;
}
current = current.Next;
}
}
Vector3 target3 = current.Value.toVector3();
Vector2 target = new Vector2(target3.x,target3.z);
Vector2 myPos = new Vector2(this.getLegs().transform.position.x,this.getLegs().transform.position.z);
return (target - myPos).normalized * this.getLegs().equilibrium;
}