Inheritance: UnityEngine.MonoBehaviour
Example #1
0
        private void CalculateTarget()
        {
            if (action == Action.Attack)
            {
                controller.updateAgentDestination = true;
                return;
            }


            controller.SetPlayerSpeed(0f);

            if (group != null)
            {
                if (group.IsLeader(this))
                {
                    if (group.route != null)
                    {
                        route = group.route;
                        SetTargetFromWaypoint();
                    }
                }
                else if (group.leader != null)
                {
                    if (group.formation == NpcGroup.Formation.SingleFile)
                    {
                        target = group.GetNpcList()[order - 1].transform;
                    }
                    else
                    {
                        if (group.GetFollowTargets().ElementAtOrDefault(order) != null)
                        {
                            target = group.GetFollowTargets()[order];
                        }
                        else
                        {
                            target = group.leader.transform;
                        }
                    }
                }
            }
            else
            {
                if (route != null)
                {
                    SetTargetFromWaypoint();
                }
            }
            controller.updateAgentDestination = true;
        }
Example #2
0
        private void CalculateTarget()
        {
            if (action == Action.Attack) {
                controller.updateAgentDestination = true;
                return;
            }

            controller.SetPlayerSpeed(0f);

            if (group != null) {
                if (group.IsLeader(this)) {
                    if (group.route != null) {
                        route = group.route;
                        SetTargetFromWaypoint();
                    }
                } else if (group.leader != null) {
                    if (group.formation == NpcGroup.Formation.SingleFile) {
                        target = group.GetNpcList()[order - 1].transform;
                    } else {
                        if (group.GetFollowTargets().ElementAtOrDefault(order) != null) {
                            target = group.GetFollowTargets()[order];
                        } else {
                            target = group.leader.transform;
                        }

                    }
                }
            } else {
                if (route != null) {
                    SetTargetFromWaypoint();
                }
            }
            controller.updateAgentDestination = true;
        }