コード例 #1
0
    // Use this for initialization
    void Start()
    {
        rb2d      = GetComponent <Rigidbody2D>();
        myplanner = GetComponent <Astar>();
        myplanner.InitVars(transform.localScale.x * GetComponent <BoxCollider2D>().size.x * 0.2f);
        player = GameObject.Find("Player");

        _replan     = true;
        _follow     = false;
        _patrolling = true;
        _alert      = false;
        _lookAround = false;

        _currentPatrolPlan = 0;
        _currentAlertPlan  = 0;

        movDirection  = new Vector3(0, -1, 0);
        _patrolPoints = _myRoom.getPatrol(_roomId);

        for (int i = 0; i < _patrolPoints.Count; i++)
        {
            Debug.DrawLine(_patrolPoints[i], _patrolPoints[i] + new Vector2(0.1f, 0.1f), Color.yellow, 60f);
        }
        _patrols = InitPatrols(_patrolPoints);
    }