コード例 #1
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Planet")
        {
            //アイテムの移動を禁止する
            rb.constraints = RigidbodyConstraints2D.FreezeAll;
            //fallflag on
            falledFlag = true;

            GameContext.SoundManager.PlayFall(this);
            gameMgr.OnItemFall(this);

            Vector2 vec_sub = (Vector2)(transform.position - star.transform.position);
            vec_sub.Normalize();
            float power = 0.0001f * consumeGPoint;
            AnimManager.AddShakeAnim(GameContext.MainCamera, vec_sub, power * 6, 20 * power, 0.05f, ParamType.Position);

            if (afterImage != null)
            {
                GetComponent <SpriteRenderer>().sprite = afterImage;
            }
        }
    }