コード例 #1
0
ファイル: Crab.cs プロジェクト: GiM6114/AIaG_GameJam
    private void Update()
    {
        if (ground.GetTile(ground.WorldToCell(transform.position)) != null)
        {
            sR.enabled = true;
        }
        else
        {
            sR.enabled = false;
        }
        if (astar == true || chasing == false)
        {
            return;
        }
        Vector2 direction = player.transform.position - transform.position;

        direction           = direction.normalized;
        transform.position += new Vector3(direction.x, direction.y, 0) * speed * Time.deltaTime;

        if (ground.GetTile(ground.WorldToCell(transform.position)) != null)
        {
            astar = true;
            eB.AngerTrigger();
        }
    }