Beispiel #1
0
    void Start()
    {
        itemDescriptionText      = GameObject.Find("ItemDescriptionText").GetComponent <Text>();
        itemDescriptionText.text = "";

        /*Scale*/ animLB[0]    = new AnimationCurve(new Keyframe(0, 9.0f), new Keyframe(fTimeToBurst, 8.0f), new Keyframe(fTimeToBurst + 1.0f, 7000.0f));
        /* Yaw */ animLB[1]    = new AnimationCurve(new Keyframe(0, 175), new Keyframe(1, 185));
        animLB[0].postWrapMode = WrapMode.ClampForever;
        animLB[1].postWrapMode = WrapMode.PingPong;

        lootbox = Instantiate(Resources.Load <GameObject>("Prefabs/lootbox"), Vector3.zero, rotation, transform);
        lootbox.transform.localScale = new Vector3(animLB[0].Evaluate(Time.timeSinceLevelLoad), animLB[0].Evaluate(Time.timeSinceLevelLoad), animLB[0].Evaluate(Time.timeSinceLevelLoad));

        UnlockManager um      = GameObject.Find("UnlockManager").GetComponent <UnlockManager>();
        Unlockable    newItem = um.UnlockRandom();

        if (newItem == null)
        {
            //SceneManager.LoadScene("GameOverScene");
            //return;
            newItem = Coins.GetComponent <Unlockable>();
        }

        {
            GameObject prefab = newItem.gameObject;
            newItemDisplay = Instantiate(prefab, Vector3.zero, rotation, transform);
            newItemDisplay.transform.localScale = Vector3.zero;
        }

        Keyframe kf2;

        fTimeToFullSize = fTimeToBurst + 0.8f;

        if (newItemDisplay.GetComponent <Unlockable>().type == UnlockableType.SKYSCRAPER)
        {
            kf2 = new Keyframe(fTimeToFullSize, 0.3f);
        }
        else if (newItemDisplay.GetComponent <Unlockable>().type == UnlockableType.HOUSE || newItemDisplay.GetComponent <Unlockable>().type == UnlockableType.SHOP)
        {
            kf2 = new Keyframe(fTimeToFullSize, 0.65f);
        }
        else
        {
            kf2 = new Keyframe(fTimeToFullSize, 1.5f);
        }
        animNID = new AnimationCurve(new Keyframe(0, 0), new Keyframe(fTimeToBurst, 0), kf2);
        animNID.postWrapMode = WrapMode.ClampForever;
    }