예제 #1
0
    private void FlyScore(Vector3 pos)
    {
        if (CameraController.Instance == null)
        {
            return;
        }

        if (WindowManager.current2DCamera == null)
        {
            return;
        }

        Vector3 fromPos = CameraController.Instance.WorldToScreenPoint(pos);

        fromPos.z = 0.0f;
        fromPos   = WindowManager.current2DCamera.ScreenToWorldPoint(fromPos);

        GameObject flyScore = (GameObject)GameObject.Instantiate(mFlySocre);

        flyScore.SetActive(true);
        flyScore.transform.parent        = mScore.transform.parent;
        flyScore.transform.localPosition = Vector3.zero;
        flyScore.transform.localRotation = Quaternion.identity;
        flyScore.transform.localScale    = Vector3.one;

        FlyEffect eff = flyScore.AddMissingComponent <FlyEffect>();

        eff.Play(fromPos, mScore.transform.localPosition, 0.5f);
    }
예제 #2
0
    // 物品飞特效,飞效果播放完成后,自动销毁go;
    void moveToBag(GameObject go, object param)
    {
        FlyEffect fly = go.AddMissingComponent <FlyEffect>();

        fly.Play(go.transform.position, (Vector3)param, 1f);
    }