Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        m_OnlyOneGesturePerBeat = true;
        m_playerBehavior        = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
        m_rhythmIdicator        = GameObject.FindGameObjectWithTag("RhythmIndicator").GetComponent <RhythmIndicator>();

        gc.GestureRecognizedInController += OnGestureRecognized;
        IRelativeGestureSegment[] swipeLeft = { new SwipeToLeftSegment1(), new SwipeToLeftSegment2(), new SwipeToLeftSegment3() };
        gc.AddGesture("SwipeLeft", swipeLeft);
        IRelativeGestureSegment[] waveLeft = { new WaveLeftSegment1(), new WaveLeftSegment2(),
                                               new WaveLeftSegment1(), new WaveLeftSegment2(),
                                               new WaveLeftSegment1(), new WaveLeftSegment2() };
        gc.AddGesture("WaveLeft", waveLeft);

        IRelativeGestureSegment[] pullLeft = { new PullToLeftSegment1(), new PullToLeftSegment2(), new PullToLeftSegment3(), };
        gc.AddGesture("PullLeft", pullLeft);

        IRelativeGestureSegment[] fireBall = { new FireBallSegment1(), new FireBallSegment2(), };
        gc.AddGesture("FireBall", fireBall);

        IRelativeGestureSegment[] moveRight = { new MoveRightSegment1(), new MoveRightSegment2() };
        gc.AddGesture("MoveRight", moveRight);

        IRelativeGestureSegment[] moveLeft = { new MoveLeftSegment1(), new MoveLeftSegment2() };
        gc.AddGesture("MoveLeft", moveLeft);

        IRelativeGestureSegment[] moveUp = { new MoveUpSegment1(), new MoveUpSegment2() };
        gc.AddGesture("MoveUp", moveUp);

        IRelativeGestureSegment[] moveDown = { new MoveDownSegment1(), new MoveDownSegment2() };
        gc.AddGesture("MoveDown", moveDown);

        IRelativeGestureSegment[] attack = { new AttackSegment1(), new AttackSegment2() };
        gc.AddGesture("Attack", attack);
    }
Beispiel #2
0
    //public enum BubbleType { left, right};
    //public BubbleType myBubbleType;

    void Start()
    {
        m_startPosition = transform.position;

        // Get rhythm indicator
        m_rhythmIndicator = GameObject.FindGameObjectWithTag("RhythmIndicator").GetComponent <RhythmIndicator>();
        Rigidbody2D myRigid = this.GetComponent <Rigidbody2D>();

        if (myRigid)
        {
            float normX = (m_rhythmIndicator.transform.position.x - m_startPosition.x) / m_rhythmIndicator.m_beatPerSecond; // Mathf.Abs(m_rhythmIndicator.transform.position.x - m_startPosition.x);
            Debug.Log("vel: " + m_rhythmIndicator.m_beatPerSecond);
            myRigid.velocity = new Vector2(normX, 0);
        }

        //StartCoroutine(MoveToPosition(transform, m_rhythmIndicator.transform.position, m_rhythmIndicator.m_beatPerSecond));
    }