Ejemplo n.º 1
0
    void Start()
    {
        anim = new TransformLerpCoroutine(
            gameObject,
            fromPos,
            toPos,
            duration
            );

        GameMoniter.startChangedEvent += StartStateChanged;
    }
Ejemplo n.º 2
0
    void Start()
    {
        anim = new TransformLerpCoroutine(
            gameObject,
            fromPos,
            toPos,
            moveTime,
            true
            );

        StartCoroutine(Cycle());
    }
Ejemplo n.º 3
0
    IEnumerator EndCycle()
    {
        yield return(new WaitForSeconds(AnimationDuration));

        //show heart
        heart.SetActive(true);

        //spawn in love audio
        Instantiate(inLoveAudio, transform.position, Quaternion.identity);

        //make negstone a whole game object
        gameObject.transform.parent = negStone.transform;
        littleNeg.transform.parent  = negStone.transform;

        //title animation & neg stone rising
        titleTransformAnimation = new TransformLerpCoroutine(
            gameTitle,
            gameTitle.transform.position,
            titleToPos,
            TitleScaleAnimationDuration
            );

        titleScalingAnimation = new ScalingLerpCoroutine(
            gameTitle,
            gameTitle.transform.localScale,
            titleToLocalScale,
            TitleScaleAnimationDuration
            );

        negStoneTransformAnimation = new TransformLerpCoroutine(
            negStone,
            negStone.transform.position,
            negStoneToPos,
            TitleScaleAnimationDuration
            );

        StartCoroutine(titleTransformAnimation.AnimationCoroutine());
        StartCoroutine(titleScalingAnimation.AnimationCoroutine());

        yield return(new WaitForSeconds(TitleScaleAnimationDuration));

        StartCoroutine(negStoneTransformAnimation.AnimationCoroutine());

        yield return(new WaitForSeconds(NegStoneRisingDuration));

        //activate win scene canvas
        winSceneCanvas.SetActive(true);
    }
Ejemplo n.º 4
0
    void Start()
    {
        number = (Instantiate(prefab, transform.position, Quaternion.identity) as GameObject);
        number.transform.parent = transform.parent;
        number.SetActive(false);
        colorAnimation = new SpriteColorLerpCoroutine(
            number,
            new Color(255f, 255f, 255f, 1f),
            new Color(255f, 255f, 255f, 0f),
            moveTime
            );

        transformAnimation = new TransformLerpCoroutine(
            number,
            transform.localPosition,
            driftToPos,
            moveTime,
            local: true
            );


        StartCoroutine(Cycle());
    }
Ejemplo n.º 5
0
    IEnumerator GoThroughPath()
    {
        int   currPos = Destinations.Length - 1;
        int   nextPos = 0;
        float duration;
        TransformLerpCoroutine currMovement;

        while (true)
        {
            duration     = Vector3.Distance(Destinations [currPos], Destinations [nextPos]) / speed;
            currMovement = new TransformLerpCoroutine(
                gameObject,
                Destinations[currPos],
                Destinations[nextPos],
                duration
                );
            StartCoroutine(currMovement.AnimationCoroutine());
            yield return(new WaitForSeconds(duration));

            nextPos = (nextPos + 1) % Destinations.Length;
            currPos = (currPos + 1) % Destinations.Length;
        }
    }
Ejemplo n.º 6
0
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            //save high score
            float previousScore = GameDataLoaderAndSaver.dataControl.GetHighScore(4, 12);
            if (previousScore < 0f || previousScore > GameMoniter.Instance.Score)
            {
                GameDataLoaderAndSaver.dataControl.SetHighScoreAndSave(4, 12, GameMoniter.Instance.Score);
            }

            //make the score text invisible
            gameScoreText.color = new Color(0f, 0f, 0f, 0f);

            //disable restart button
            GameMoniter.Instance.restartButton.SetActive(false);

            littleNeg.GetComponent <Rigidbody2D> ().velocity        = Vector2.zero;
            littleNeg.GetComponent <Rigidbody2D> ().isKinematic     = true;
            littleNeg.GetComponent <Rigidbody2D> ().angularVelocity = 0f;

            //destroy game objects
            foreach (GameObject go in objectsToDestroy)
            {
                Destroy(go);
            }

            //destroy charges
            foreach (ElectricCharge electricCharge in GameMoniter.Instance.charges)
            {
                GameObject go = electricCharge.gameObject;
                if (go != gameObject && go != negStone)
                {
                    Destroy(go);
                }
            }

            //init coroutines
            littleNegRotationAnimation = new RotationLerpCoroutine(
                littleNeg,
                littleNeg.transform.eulerAngles.z,
                Quaternion.identity.eulerAngles.z,
                AnimationDuration
                );

            littleNegTransformAnimation = new TransformLerpCoroutine(
                littleNeg,
                littleNeg.transform.position,
                littleNegToPos,
                AnimationDuration
                );

            littlePosTransformAnimation = new TransformLerpCoroutine(
                gameObject,
                transform.position,
                littlePosToPos,
                AnimationDuration,
                true
                );

            //start coroutines
            StartCoroutine(littleNegRotationAnimation.AnimationCoroutine());
            StartCoroutine(littlePosTransformAnimation.AnimationCoroutine());
            StartCoroutine(littleNegTransformAnimation.AnimationCoroutine());

            //end
            StartCoroutine(EndCycle());
        }
    }