コード例 #1
0
    public Vector3 GetGoalPos(FlockAgent agent)
    {
        Vector3 gol = Vector3.zero;

        foreach (var a in _flock)
        {
            var ai = a.GetComponent <FlockAgent>();

            if (ai.IsFlocking() || ai.GetType() == agent.GetType())
            {
                continue;
            }
            else
            {
                gol = a.position;

                break;
            }
        }
        if (gol == Vector3.zero)
        {
            return(gol);
        }
        else
        {
            return(gol - agent.transform.position);
        }
    }