コード例 #1
0
    void FixedUpdate()
    {
        checkGround();
        if (displaydata.GetBlinkValue() > 75)
        {
            canJump = true;
        }
        else
        {
            canJump = false;
        }

        if (isGrounded && canJump)
        {
            rb.AddForce(new Vector2(transform.position.x, jump), ForceMode2D.Impulse);
            canJump = false;
        }

        if (displaydata.GetAttetionValue() > 70)
        {
            anim.SetBool("walk", true);
        }
        else
        {
            anim.SetBool("walk", false);
        }
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (displayData.GetAttetionValue() > 70)
     {
         Vector2 currentOffset = render.material.GetTextureOffset("_MainTex");
         Vector2 deltaOffset   = new Vector2(currentOffset.x + scrollSpeed, 0);
         render.material.SetTextureOffset("_MainTex", deltaOffset);
     }
 }
コード例 #3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (displaydata.GetAttetionValue() > 70)
        {
            rb.AddForce(new Vector2(-speed * Time.deltaTime, 0), ForceMode2D.Impulse);
        }

        if (transform.position.y < -5)
        {
            GameObject.Destroy(this.gameObject);
            spawn.spawnCount--;
        }
    }
コード例 #4
0
 // Update is called once per frame
 void Update()
 {
     if (displaydata.GetAttetionValue() > 70 && spawnCount < 2)
     {
         currentTime += Time.deltaTime;
         if (currentTime > timeToSpawn)
         {
             currentTime = 0f;
             timeToSpawn = Random.Range(3, 10);
             spawnCount++;
             Instantiate(boxPrefab, transform.position, Quaternion.identity);
         }
     }
 }