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


C# EnemyController.GetAggroRadius方法代码示例

本文整理汇总了C#中EnemyController.GetAggroRadius方法的典型用法代码示例。如果您正苦于以下问题:C# EnemyController.GetAggroRadius方法的具体用法?C# EnemyController.GetAggroRadius怎么用?C# EnemyController.GetAggroRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnemyController的用法示例。


在下文中一共展示了EnemyController.GetAggroRadius方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveLogic

    public Vector3 MoveLogic(EnemyController enemy, GameObject player)
    {
        float dist = LMHelper.GetDistance(enemy, player);
        Vector3 mvt = new Vector3(0f, 0f, 0f);
        enemy.SetStationary(true);

        // Aggro if in range
        if (dist <= enemy.GetAggroRadius())
        {
            enemy.SetAggroState(true);
        }
        else {
            enemy.SetAggroState(false);
        }
        return mvt;
    }
开发者ID:mattgor123,项目名称:CS355-Robo-Clean-5000,代码行数:16,代码来源:LMStationary.cs

示例2: MoveLogic

    public Vector3 MoveLogic(EnemyController enemy, GameObject player)
    {
        float dist = LMHelper.GetDistance(enemy, player);
        Vector3 mvt = new Vector3(0f, 0f, 0f);

        // If in aggro range, set aggro state to true
        if (dist <= enemy.GetAggroRadius())
        {
            enemy.SetAggroState(true);

            //if not already strafing or reached strafe target, setup new one
            if (Strafing == false || distST < 5) {
                Strafing = true;

                //Raycast out in direction of player
                Vector3 dir = LMHelper.BaseMoveLogic(enemy, player);
                this.transform.forward = dir;
                RaycastHit hit;
                float tdist = 0;
                if (Physics.Raycast(this.transform.position, dir, out hit))
                {
                    tdist = hit.distance;
                }
                StrafeTarget = this.transform.position + dir * tdist;
                mvt = dir;
            }

            //else, continue along strafing path towards target
            else
            {
                mvt = (StrafeTarget - this.transform.position).normalized;
            }

        }
        else {
            enemy.SetAggroState(false);
            Strafing = false;
        }

        //Debug.Log(Strafing + "," + StrafeTarget + "," + mvt);

        return mvt;
    }
开发者ID:mattgor123,项目名称:CS355-Robo-Clean-5000,代码行数:43,代码来源:LMStrafingRun.cs

示例3: MoveLogic

    public Vector3 MoveLogic(EnemyController enemy, GameObject player)
    {
        float dist = LMHelper.GetDistance(enemy, player);
        float optrng = enemy.GetOptimalRange();
        float delta = dist - optrng;    //difference from optimal range
        Vector3 mvt = new Vector3(0f, 0f, 0f);

        // If out of range, move into range
        if (dist <= enemy.GetAggroRadius())
        {
            enemy.SetAggroState(true);
            if (delta > 0) {
                mvt = LMHelper.BaseMoveLogic(enemy, player);
                mvt *= delta / (1.5f * optrng);
            }
        }
        else {
            enemy.SetAggroState(false);
        }
        return mvt;
    }
开发者ID:mattgor123,项目名称:CS355-Robo-Clean-5000,代码行数:21,代码来源:LMHoldRange.cs

示例4: IsInRange

 //Checks whether target is in range
 public static bool IsInRange(EnemyController enemy, GameObject player)
 {
     float dist = GetDistance(enemy, player);
     return dist <= enemy.GetAggroRadius();
 }
开发者ID:mattgor123,项目名称:CS355-Robo-Clean-5000,代码行数:6,代码来源:LMHelper.cs


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