コード例 #1
0
ファイル: Gem.cs プロジェクト: tchendos/beastsidestory
    public void TweenPosition(float duration, Vector3 pos, Tweener.Method method, bool steeperCurves)
    {
        PositionTween tweenPosition = PositionTween.Begin(gameObject, duration, pos);

        tweenPosition.method        = method;
        tweenPosition.steeperCurves = steeperCurves;
    }
コード例 #2
0
ファイル: Effects.cs プロジェクト: tchendos/beastsidestory
    static public IEnumerator Pulse(float timeFly, float timeFlyWait, float timeHit,
                                    GameObject particleBegin, GameObject particleHit, GameObject particleDanger,
                                    Vector3 startPosition, Vector3 destPosition, bool fly)
    {
        GameObject p = (GameObject)Instantiate(particleHit);

        p.transform.parent     = GameManager.Instance.Definitions.FieldRoot.transform;
        p.transform.position   = startPosition;
        p.transform.localScale = new Vector3(1, 1, 1);
        p.SetActive(true);

        GameObject p1 = null;

        if (particleBegin != null)
        {
            p1 = (GameObject)Instantiate(particleBegin);
            p1.transform.position   = startPosition;
            p1.transform.localScale = new Vector3(1, 1, 1);
            p1.SetActive(true);
        }

        PositionTween tweenPosition;

        if (fly)
        {
            Vector3 destPositionLocal = p.transform.worldToLocalMatrix.MultiplyVector(destPosition);

            tweenPosition        = PositionTween.Begin(p, timeFly, destPositionLocal);
            tweenPosition.method = Tweener.Method.EaseIn;
        }

        yield return(new WaitForSeconds(timeFlyWait));

        GameObject p2 = (GameObject)Instantiate(particleDanger);

        p2.transform.parent     = GameManager.Instance.Definitions.FieldRoot.transform;
        p2.transform.position   = destPosition;
        p2.transform.localScale = new Vector3(1, 1, 1);
        p2.SetActive(true);

        yield return(new WaitForSeconds(timeHit));

        if (p1 != null)
        {
            GameObject.Destroy(p1);
        }
        GameObject.Destroy(p);
        GameObject.Destroy(p2);
    }
コード例 #3
0
ファイル: Effects.cs プロジェクト: tchendos/beastsidestory
    public static IEnumerator Shake(GameObject go, float time)
    {
        float         pTime         = time / 4;
        Vector3       position      = go.transform.localPosition;
        PositionTween tweenPosition = PositionTween.Begin(go, pTime, position + new Vector3(-10, 0, 0));

        tweenPosition.method        = Tweener.Method.EaseOut;
        tweenPosition.steeperCurves = true;

        yield return(new WaitForSeconds(pTime));

        tweenPosition        = PositionTween.Begin(go, pTime, position + new Vector3(10, 0, 0));
        tweenPosition.method = Tweener.Method.Linear;

        yield return(new WaitForSeconds(pTime * 2));

        tweenPosition        = PositionTween.Begin(go, pTime, position);
        tweenPosition.method = Tweener.Method.Linear;

        yield return(new WaitForSeconds(pTime));
    }