Inheritance: MonoBehaviour
Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     swipeController               = GetComponent <SwipeControl>();
     swipeController.OnSwipeLeft  += onSwipeLeft;
     swipeController.OnSwipeRight += onSwipeRight;
     swipeController.OnTouchUp    += onTouchEnded;
 }
Beispiel #2
0
 public void Play()
 {
     State = lvlState.Play;
     SwipeControl.ResetFp();
     SwipeControl.BlockSwipeInput();
     StartPage.SetActive(false);
 }
Beispiel #3
0
    void Awake()
    {
        credits[0] = "Denis" + '\n' + "Do Something";
        credits[1] = "Li" + '\n' + "My knife can stop life";
        credits[2] = "Vova" + '\n' + "HATE MAINSTREAM";
        credits[3] = "OLeg" + '\n' + "Amazing";
        credits[4] = "Andrei" + '\n' + "Dangerous";
        credits[5] = "Dima" + '\n' + "There are you?";

        if(!swipeCtrl) swipeCtrl = gameObject.GetComponent<SwipeControl>(); //Find SwipeControl on same GameObject if none given

        if(centerMatrixOnScreen) {
            matrixPosition.x += Mathf.Round(Screen.width * 0.5f);
            matrixPosition.y += Mathf.Round(Screen.height * 0.5f);
        }

        if(myRect == new Rect(0,0,0,0)) { //If no rect given, create default rect
            myRect = new Rect(-Screen.height * 0.5f, -Screen.height * 0.5f, Screen.height, Screen.height);
        }

        //Set up SwipeControl
        swipeCtrl.partWidth = Screen.height;
        swipeCtrl.maxValue = credits.Length - 1;
        swipeCtrl.SetMouseRect(myRect);
        swipeCtrl.Setup();
    }
Beispiel #4
0
    void LastPlanetSelected()
    {
        SwipeControl sc = GameObject.Find("PlanetChoice").GetComponent <SwipeControl> ();

        if (sc == null)
        {
            Debug.LogError("Unable to get script.");
            return;
        }


        switch (setGameMode)
        {
        case "Addition":
            //預設就會到,不做事
            break;

        case "Division":
            //上划兩個
            sc.swipeAfter();
            sc.swipeAfter();
            break;

        case "Subtraction":
            //上划一個
            sc.swipeAfter();
            break;

        default:
            Debug.Log("Unable to get last planet set.");
            break;
        }
        setGameMode = null;
    }
Beispiel #5
0
	void Awake () {
	
		if(!swipeCtrl) swipeCtrl = gameObject.GetComponent<SwipeControl>(); //Find SwipeControl on same GameObject if none given
	
		if(imgRect == new Rect(0,0,0,0)) { //If no rect given, create default rect
			imgRect = new Rect(-img[0].width * 0.5f, -img[0].height * 0.5f, img[0].width, img[0].height);
		}
		
		//Set up SwipeControl
		swipeCtrl.partWidth = img[0].width;
		swipeCtrl.maxValue = img.Length - 1;
		if(expandInputAreaToFullWidth) {
			swipeCtrl.SetMouseRect(new Rect(-Screen.width * 0.5f, imgRect.y, Screen.width, imgRect.height)); // Use image-height for the input-Rect, but full screen-width
		} else {
			 swipeCtrl.SetMouseRect(imgRect); //Use the same Rect as the images for input
		}
		swipeCtrl.CalculateEdgeRectsFromMouseRect(imgRect);
		swipeCtrl.Setup();
		
		//Determine center position of the Dots
		if(dotRelativeCenterPos == Vector2.zero) dotRelativeCenterPos.y = imgRect.height * 0.5f + 14f;
		dotRelativeCenterPos = new Vector2((imgRect.x + imgRect.width * 0.5f) + dotRelativeCenterPos.x, (imgRect.y + imgRect.height * 0.5f) + dotRelativeCenterPos.y);
	
		if(centerMatrixOnScreen) { 
			matrixPosition.x += Mathf.Round(Screen.width * 0.5f);
			matrixPosition.y += Mathf.Round(Screen.height * 0.5f);
		}
		
	}
Beispiel #6
0
    // Start is called before the first frame update
    void Start()
    {
        gm   = FindObjectOfType <GameManager>();
        sc   = GetComponent <SwipeControl>();
        body = GetComponent <Rigidbody2D>();

        anim = GetComponent <Animator>();
        anim.SetFloat("runSpeed", speed / 100);
        anim.SetFloat("slideDuration", 1 / slideDuration);

        animations = anim.GetNextAnimatorClipInfo(0);

        for (int i = 0; i < animations.Length; i++)
        {
            Debug.Log("Here");
            if (animations[i].clip.name == "Jump")
            {
                jumpDuration = animations[i].clip.averageDuration;
                Debug.Log(animations[i].clip.averageDuration);
            }
        }

        collider = GetComponent <CapsuleCollider2D>();
        colliderOriginalOffset = collider.offset;
        colliderOriginalSize   = collider.size;
    }
 void Awake()
 {
     if (!swipeCtrl)
     {
         swipeCtrl = gameObject.GetComponent <SwipeControl>();                   //Find SwipeControl on same GameObject if none given
     }
 }
Beispiel #8
0
    public void GetExperience()// 可以改成回傳int做更多應用
    {
        SwipeControl sc = GameObject.Find("PlanetChoice").GetComponent <SwipeControl> ();

        if (sc == null)
        {
            Debug.LogError("Unable to get script.");
            return;
        }
        switch (sc.CurrentChoice)
        {
        case 0:
            ExperienceText.text = LevelControl.expAdd.ToString();

            break;

        case 1:
            ExperienceText.text = LevelControl.expSub.ToString();

            break;

        case 2:
            ExperienceText.text = LevelControl.expDiv.ToString();

            break;

        default:
            Debug.Log("Unable to get last planet set.");
            break;
        }
        setGameMode = null;
    }
Beispiel #9
0
 void SwipeControl_Swiped(object sender, SwipeCards.Controls.Arguments.SwipedEventArgs e)
 {
     if (e.Item == ViewModelLocator.MainViewModel.SelectedUserChores.Last())
     {
         SwipeControl.Setup();
     }
 }
    private void Start()
    {
        Screen.orientation = ScreenOrientation.Portrait;
        swipeInput         = GetComponent <SwipeControl>();

        anim         = cubeMesh.GetComponent <AnimationScript>();
        animEdgeFlag = false;
        isMoving     = false;

        rightRay   = Right.GetComponent <RayCastScript>();
        leftRay    = Left.GetComponent <RayCastScript>();
        forwardRay = Forward.GetComponent <RayCastScript>();
        backRay    = Back.GetComponent <RayCastScript>();
        downRay    = Down.GetComponent <RayCastScript>();

        RightRotation   = Vector3.back;
        LeftRotation    = Vector3.forward;
        ForwardRotation = Vector3.right;
        BackRotation    = Vector3.left;

        trigFlag        = false;
        rotateFlag      = false;
        atEdge          = false;
        destinationFlag = true;
        destination     = transform.localPosition;

        MazeOffset   = MazeSize / 2;
        DownStep     = MazeOffset / 4;
        mazeRotation = MazeBody.GetComponent <MazeBodyRotation>();

        Load();
    }
 private void Start()
 {
     player           = GameObject.Find("Player").transform;
     powerupSpawner   = GameObject.Find("Powerups Manager").GetComponent <PowerupSpawner>();
     swipeControl     = player.gameObject.GetComponent <SwipeControl>();
     myCopyOfMaterial = new Material(material);
     myCopyOfMaterial.EnableKeyword("_Emission");
     myCopyOfMaterial.SetColor("_EmissionColor", Color.clear);
     meshRenderer.sharedMaterial = myCopyOfMaterial;
     currentHealth = health;
 }
Beispiel #12
0
 void Start()
 {
     if (PlayerPrefs.GetInt("Currentlevel") != 0)
     {
         Tutpanel.SetActive(false);
     }
     swp            = transform.GetComponent <SwipeControl>();
     currentpos     = transform.position.y;
     anim           = transform.GetComponent <Animator>();
     flatcontroller = GameObject.Find("FlatControl").GetComponent <FlatController>();
     flatcontroller.NextFloorEvent += MoveNextFloor;
 }
 public void SwipeControlCanOnlyBeHorizontalOrVertical()
 {
     RunOnUIThread.Execute(() =>
     {
         SwipeControl swipeControl = new SwipeControl();
         swipeControl.LeftItems    = new SwipeItems();
         var topItems = new SwipeItems();
         topItems.Add(new SwipeItem());
         swipeControl.TopItems = topItems;
         Verify.Throws <ArgumentException>(() => { swipeControl.LeftItems.Add(new SwipeItem()); });
     });
 }
Beispiel #14
0
    void Start()
    {
        //Diziyi oluştur scripti al ve slot sayısını al.
        swipeControlScript = transform.GetComponent <SwipeControl>();
        slotsScript        = transform.GetChild(0).GetComponent <Slots>();
        numberOfSlots      = slotsScript.NumberOfSlots;
        slots = new Image[numberOfSlots];

        //Slotları al.
        for (int i = 0; i < numberOfSlots; i++)
        {
            slots[i] = transform.GetChild(0).transform.GetChild(i).GetComponent <Image>();
        }
        SortSlots();
    }
        public void SwipeControlCanOnlyBeHorizontalOrVerticalAfterRendering()
        {
            var resetEvent = new AutoResetEvent(false);

            RunOnUIThread.Execute(() =>
            {
                SwipeControl swipeControl = new SwipeControl();
                swipeControl.Loaded      += (object sender, RoutedEventArgs args) => { resetEvent.Set(); };
                Content = swipeControl;
                Content.UpdateLayout();
                swipeControl.TopItems  = new SwipeItems();
                swipeControl.LeftItems = new SwipeItems();
                swipeControl.LeftItems.Add(new SwipeItem());
                Verify.Throws <ArgumentException>(() => { swipeControl.TopItems.Add(new SwipeItem()); });
            });
        }
Beispiel #16
0
    private void Update()
    {
        if (LevelManager.State != LevelManager.lvlState.Play)
        {
            return;
        }

        if (DS.GetComponent <DarkScreenControl>().Dark&& Map != null && player == null)
        {
            DestroyMap();
        }
        if (Map == null)
        {
            LoadMap();
            player.SetActive(false);
            lvlPart++;
        }

        if (player == null)
        {
            return;
        }
        rt = player.transform.Find("playeralign");

        if (player.activeSelf == false)
        {
            player.SetActive(true);
        }
        if (TotalBlockCount == GetComponentInChildren <PlayerControl>().DoneBlockCount)
        {
            SwipeControl.BlockSwipeInput();
            Destroy(player);
            StartBaloons();
            if ((LevelManager.State != LevelManager.lvlState.Fin) && (lvlPart == 3))
            {
                LevelManager.State = LevelManager.lvlState.Fin;
                lvlPart            = 1;
            }
            else
            {
                DS.SetTrigger("Disappear");
            }
        }
    }
Beispiel #17
0
 private void CheckAcceptFlagBool(SwipeControl swipeCtrl)
 {
     if (isAccepted && !isFlagged)
     {
         ((TextBlock)swipeCtrl.Content).Text = "Swipe Right - Accepted";
     }
     else if (isAccepted && isFlagged)
     {
         ((TextBlock)swipeCtrl.Content).Text = "Swipe Right - Accepted & Flagged";
     }
     else if (!isAccepted && isFlagged)
     {
         ((TextBlock)swipeCtrl.Content).Text = "Swipe Right - Flagged";
     }
     else
     {
         ((TextBlock)swipeCtrl.Content).Text = "Swipe Right";
     }
 }
Beispiel #18
0
    protected override void onStart()
    {
        base.onStart();


        if (!swipeCtrl)
        {
            swipeCtrl = gameObject.GetComponent <SwipeControl> ();            //Find SwipeControl on same GameObject if none given
        }
        ignoreTimeScale = true;

        var worldsCnt = 7;

        buttons = new Transform[worldsCnt];
        for (int i = 0; i < worldsCnt; i++)
        {
            var ch = Instantiate(button);
            ch.parent = transform;
            ch.GetComponent <LevelButton> ().init(i + 1);
            ch.name     = "button" + i;
            buttons [i] = ch;
            var p = new Vector3(dx * i, .4f, 0);
            ch.localPosition = p;

            var d = Instantiate(dot);
            d.parent        = transform;
            d.name          = "dot" + i;
            p               = new Vector3(.4f * i - worldsCnt * .5f * .4f, -3f, 0);
            d.localPosition = p;
        }
        maxXPos           = dx * worldsCnt;
        swipeSmoothFactor = 1f / worldsCnt;

        xDist = maxXPos - minXPos;         //calculate distance between min and max


        swipeCtrl.SetMouseRect(new Rect(0, 0, Screen.width, Screen.height * .9f)); //entire screen
        swipeCtrl.maxValue     = worldsCnt - 1;                                    //max value
        swipeCtrl.currentValue = 0;                                                //current value set to max, so it starts from the end
        swipeCtrl.startValue   = 0;                                                //Mathf.RoundToInt ((gameModel.skin-1) * 0.5f); //when Setup() is called it will animate from the end to the middle
        swipeCtrl.partWidth    = Screen.width / 2;                                 //how many pixels do you have to swipe to change the value by one? in this case we make it dependent on the screen-width and the maxValue, so swiping from one edge of the screen to the other will scroll through all values.
        swipeCtrl.Setup();
    }
Beispiel #19
0
	void Awake () {
	
		if(!swipeCtrl) swipeCtrl = gameObject.GetComponent<SwipeControl>(); //Find SwipeControl on same GameObject if none given
	
		if(centerMatrixOnScreen) { 
			matrixPosition.x += Mathf.Round(Screen.width * 0.5f);
			matrixPosition.y += Mathf.Round(Screen.height * 0.5f);
		}
	
		if(myRect == new Rect(0,0,0,0)) { //If no rect given, create default rect
			myRect = new Rect(-img[1].width * 0.5f, -img[1].height * 0.5f, img[1].width, img[1].height);
		}
		
		//Set up SwipeControl
		swipeCtrl.partWidth = img[1].width;
		swipeCtrl.maxValue = img.Length - 1;
		swipeCtrl.SetMouseRect(myRect); 
		swipeCtrl.Setup();
	
	}
 public void SwipeControlTest()
 {
     RunOnUIThread.Execute(() =>
     {
         SwipeControl swipeControl = new SwipeControl();
         Verify.AreEqual(swipeControl.ActualHeight, 0);
         Verify.AreEqual(swipeControl.ActualWidth, 0);
         Verify.IsNull(swipeControl.LeftItems);
         Verify.IsNull(swipeControl.RightItems);
         Verify.IsNull(swipeControl.TopItems);
         Verify.IsNull(swipeControl.BottomItems);
         swipeControl.LeftItems  = new SwipeItems();
         swipeControl.RightItems = new SwipeItems();
         Content = swipeControl;
         Content.UpdateLayout();
         Verify.IsFalse(swipeControl.IsTabStop);
         Verify.IsNotNull(swipeControl.LeftItems);
         Verify.IsNotNull(swipeControl.RightItems);
     });
 }
Beispiel #21
0
    /// <summary>
    /// enable swipe control
    /// </summary>
    void Awake()
    {
        if (!swipeCtrl)
        {
            swipeCtrl = gameObject.GetComponent <SwipeControl>();            //Find SwipeControl on same GameObject if none given
        }
        if (imgRect == new Rect(0, 0, 0, 0))
        { //If no rect given, create default rect
            imgRect = new Rect(-(Screen.width * 0.8f) * 0.5f, -(Screen.width * 0.8f) * 0.5f, (Screen.width * 0.8f), (Screen.width * 0.8f));
        }

        //Set up SwipeControl
        swipeCtrl.partWidth = img[0].width;
        swipeCtrl.maxValue  = img.Length - 1;
        if (expandInputAreaToFullWidth)
        {
            swipeCtrl.SetMouseRect(new Rect(-Screen.width * 0.5f, imgRect.y, Screen.width, imgRect.height)); // Use image-height for the input-Rect, but full screen-width
        }
        else
        {
            swipeCtrl.SetMouseRect(imgRect); //Use the same Rect as the images for input
        }
        swipeCtrl.CalculateEdgeRectsFromMouseRect(imgRect);
        swipeCtrl.Setup();

        //Determine center position of the Dots
        if (dotRelativeCenterPos == Vector2.zero)
        {
            dotRelativeCenterPos.y = imgRect.height * 0.5f + 14f;
        }
        dotRelativeCenterPos = new Vector2(0, imgRect.height * 0.6f);
        Debug.Log("ImageRect: " + imgRect.height);

        Debug.Log("dotX: " + imgRect.x);

        if (centerMatrixOnScreen)
        {
            matrixPosition.x += Mathf.Round(Screen.width * 0.5f);
            matrixPosition.y += Mathf.Round(Screen.height * 0.5f);
        }
    }
    private void InitializeGameSession()
    {
        gameLogic = new GameLogic();

        swipeControl = Instantiate(swipeControlPrefab).GetComponent <SwipeControl>();

        // initializing the paddles
        short otherPlayerNumber = 0;

        if (playerNumber == 1)
        {
            myPaddle          = CreatePaddle(gameLogic.paddle1, paddle1Prefab).GetComponent <Paddle> ();
            opponentPaddle    = CreatePaddle(gameLogic.paddle2, paddle2Prefab).GetComponent <Paddle> ();
            otherPlayerNumber = 2;
        }
        else
        {
            myPaddle          = CreatePaddle(gameLogic.paddle2, paddle2Prefab).GetComponent <Paddle> ();
            opponentPaddle    = CreatePaddle(gameLogic.paddle1, paddle1Prefab).GetComponent <Paddle> ();
            otherPlayerNumber = 1;
        }

        // only if we are running in mobile
        //#if UNITY_IOS
        myPaddle.SetSwipeControl(swipeControl);
        //#endif

        myPaddle.SetIsPaddleControlledByThisClient(true);
        myPaddle.SetGameModel(gameId, gameLogic, playerNumber);

        opponentPaddle.SetIsPaddleControlledByThisClient(false);
        opponentPaddle.SetGameModel(gameId, gameLogic, otherPlayerNumber);
        opponentPaddle.GetComponent <Renderer>().enabled = false;

        // initializing the ball
        ball = Instantiate(ballPrefab).GetComponent <Ball>();
        ball.SetGameModel(gameId, gameLogic);
        ball.GetComponentsInChildren <Renderer>()[0].enabled = false;
    }
Beispiel #23
0
    void Awake()
    {
        if (!swipeCtrl)
        {
            swipeCtrl = gameObject.GetComponent <SwipeControl>();                   //Find SwipeControl on same GameObject if none given
        }
        if (centerMatrixOnScreen)
        {
            matrixPosition.x += Mathf.Round(Screen.width * 0.5f);
            matrixPosition.y += Mathf.Round(Screen.height * 0.5f);
        }

        if (myRect == new Rect(0, 0, 0, 0))       //If no rect given, create default rect
        {
            myRect = new Rect(-img[1].width * 0.5f, -img[1].height * 0.5f, img[1].width, img[1].height);
        }

        //Set up SwipeControl
        swipeCtrl.partWidth = img[1].width;
        swipeCtrl.maxValue  = img.Length - 1;
        swipeCtrl.SetMouseRect(myRect);
        swipeCtrl.Setup();
    }
Beispiel #24
0
    private void Awake()
    {
        Spikes.EditorMode  = false;
        Screen.orientation = ScreenOrientation.Portrait;
        swipeInput         = GetComponent <SwipeControl>();

        anim = cubeMesh.GetComponent <AnimationScript>();

        rightRay   = Right.GetComponent <RayCastScript>();
        leftRay    = Left.GetComponent <RayCastScript>();
        forwardRay = Forward.GetComponent <RayCastScript>();
        backRay    = Back.GetComponent <RayCastScript>();
        downRay    = Down.GetComponent <RayCastScript>();


        RightRotation   = Vector3.back;
        LeftRotation    = Vector3.forward;
        ForwardRotation = Vector3.right;
        BackRotation    = Vector3.left;

        //destination = transform.localPosition;
        mazeRotation = MazeBody.GetComponent <MazeBodyRotation>();
    }
Beispiel #25
0
    private void MyCallbackMethod( SwipeControl.SWIPE_DIRECTION iDirection )
    {
        m_enCurrentDirection = iDirection;

        //this.transform.rotation = Quaternion.identity;
        m_fSpeed = 600.0f;

        switch ( iDirection ) {
        case SwipeControl.SWIPE_DIRECTION.SD_UP:
            m_vRotationDirection = new Vector3( 1.0f, 0.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_DOWN:
            m_vRotationDirection = new Vector3( -1.0f, 0.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_LEFT:
            m_vRotationDirection = new Vector3( 0.0f, 1.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_RIGHT:
            m_vRotationDirection = new Vector3( 0.0f, -1.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_DOWN_LEFT:
            m_vRotationDirection = new Vector3( -1.0f, 1.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_DOWN_RIGHT:
            m_vRotationDirection = new Vector3( -1.0f, -1.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_UP_LEFT:
            m_vRotationDirection = new Vector3( 1.0f, 1.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_UP_RIGHT:
            m_vRotationDirection = new Vector3( 1.0f, -1.0f, 0.0f );
            break;
        case SwipeControl.SWIPE_DIRECTION.SD_TOUCH:
            m_vRotationDirection = new Vector3( 0.0f, 0.0f, 0.0f );
            break;
        }
    }
    public UnityEvent onSwipe;                                                                          //событие при свайпе

    void Awake()
    {
        Instance = this;
    }
Beispiel #27
0
    void FixedUpdate()
    {
        if (!IsInGame())
        {
            var map = GetComponentInParent <MapData>();
            SwipeControl.BlockSwipeInput();
            map.player = Instantiate(map.PlayerPrafab, map.PlayerPos, Quaternion.Euler(startEuler), map.transform);
            if (DoneBlockCount != 0)
            {
                map.player.GetComponent <PlayerControl>().DoneBlockCount = DoneBlockCount;
            }
            Destroy(this.gameObject);
        }
        velocity = GetComponent <Rigidbody2D>().velocity;
        if (velocity.magnitude < speed / 1000 || velocity.magnitude > speed * 2f)
        {
            velocity = Vector2.zero;
        }
        else
        {
            ChangeFactor(GetDistance(viewDir));
        }
        if (Mathf.Abs(velocity.x) > Mathf.Abs(velocity.y))
        {
            velocity.y = 0;
        }
        if (Mathf.Abs(velocity.y) > Mathf.Abs(velocity.x))
        {
            velocity.x = 0;
        }
        if (preVelocity != 0 && velocity.magnitude == 0 && SwipeControl.AllowSwipes)
        {
            RotationSkin.Find("playerscaler").GetComponent <Animator>().SetTrigger("hited");
            // ps.loop=false;
            var ps = CarParticles.transform.Find("FX_DirtSplatter").GetComponent <ParticleSystem>().emission;
            ps.enabled = false;

            // CarParticles.transform.Find("FX_DirtSplatter").GetComponent<ParticleSystem>().enableEmission = false;
            // CarParticles.transform.Find("FX_DirtSplatter").GetComponent<ParticleSystem>().Stop();

            Vibration.Vibrate(VibroMillis);
        }
        preVelocity = velocity.magnitude;


        if (velocity.magnitude > 0)
        {
            SwipeControl.ResetFp();
            // SwipeControl.BlockSwipeInput();
            UpdateVelocity(viewDir);
            GetComponent <Rigidbody2D>().velocity = velocity;
            return;
        }

        preViewDir = viewDir;

        if (Input.GetKeyDown("w") || SwipeControl.GetUpSwipe())
        {
            viewDir = Vector2.up;
            // RotationSkin.eulerAngles= Vector3.forward*90;
        }
        if (Input.GetKeyDown("s") || SwipeControl.GetDownSwipe())
        {
            viewDir = Vector2.down;
            // RotationSkin.eulerAngles= Vector3.forward*(-90);
        }
        if (Input.GetKeyDown("a") || SwipeControl.GetLeftSwipe())
        {
            viewDir = Vector2.left;
            // RotationSkin.eulerAngles= Vector3.forward*180;
        }
        if (Input.GetKeyDown("d") || SwipeControl.GetRightSwipe())
        {
            viewDir = Vector2.right;
            // RotationSkin.eulerAngles= Vector3.zero;
        }


        if (velocity.normalized != viewDir)
        {
            RotationSkin.eulerAngles = GetEulerToAlign();
            // Debug.Log(RotationSkin.eulerAngles+"  "+GetEulerToAlign());
            // Debug.DrawRay(RotationSkin.position,viewDir*10,Color.red,10);
            SetVelocity(viewDir);
        }
    }
Beispiel #28
0
 void Awake()
 {
     instance = this;
 }
	void Awake() {
		if(!swipeCtrl) swipeCtrl = gameObject.GetComponent<SwipeControl>(); //Find SwipeControl on same GameObject if none given
	}
 void Start()
 {
     sc   = GetComponent <SwipeControl>();
     body = GetComponent <Rigidbody2D>();
     anim = GetComponent <Animator>();
 }
 internal SwipeItemInvokedEventArgs(SwipeControl swipeControl)
 {
     SwipeControl = swipeControl;
 }
Beispiel #32
0
 public void Laning()
 {
     GetComponentInParent <BoxCollider2D>().enabled = true;
     transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, 0);
     SwipeControl.AllowSwipeInput();
 }
 public void SetSwipeControl(SwipeControl swipeControl)
 {
     this.swipeControl = swipeControl;
     swipeControl.SetMethodToCall(DetectInputFromMobile);
     this.isMobile = true;
 }