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


C# LayerMask.AddToMask方法代码示例

本文整理汇总了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;
        }
    }
开发者ID:Syclamoth,项目名称:GamesAI6,代码行数:22,代码来源:PathfindToPoint.cs

示例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;
    }
开发者ID:Syclamoth,项目名称:GamesAI6,代码行数:36,代码来源:PathfindToPoint.cs


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