コード例 #1
0
    //void OnDrawGizmos()
    //{
    //    Gizmos.DrawCube(new Vector2(patrolTargetX, transform.position.y), Vector3.one/3);
    //}

    public void changeState(dinoState newState)
    {
        lastState    = currentState;
        currentState = newState;
        if (newState == dinoState.patrol)
        {
            getNewPatrolTarget();
        }
    }
コード例 #2
0
    void Start()
    {
        radius         = GetComponentInChildren <CircleCollider2D>().radius *transform.localScale.x;
        animator       = GetComponent <Animator>();
        goundedChecker = GetComponent <isGroundedRaycaster>();

        wallBuffer = GetComponent <BoxCollider2D>().bounds.extents.x *transform.lossyScale.x + 0.03f;

        currentState = dinoState.patrol;
        lastState    = currentState;
        getNewPatrolTarget();

        StartCoroutine("searchAndCharge");
        StartCoroutine("patrol");
    }