/***************************************************** * DECREASE ANGLE * * INFO: Diminue l'angle de rotation (swipe) lorsque * l'utilisateur appui sur le bouton (-), puis * met a jour la valeur affiché sur le label. * L'angle minimum est de 10°. * *****************************************************/ public void DecreaseAngle() { angleLabel = GameObject.FindWithTag("AngleLabel").GetComponent <TextMeshPro>(); if (angle > 10f && angleLabel != null) { angle -= incrRotation; angleLabel.text = angle.ToString() + "°"; RotationController.GetInstance().SetAngle(angle); } }
/***************************************************** * SET FREE ROTATION * * INFO: Permet d'activer ou désactiver la rotation * par swipe sans contrôle d'angle. * *****************************************************/ public void SetFreeRotation() { SpriteRenderer lockedRotation = GameObject.FindWithTag("LockedRotation").GetComponent <SpriteRenderer>(); SpriteRenderer unlockedRotation = GameObject.FindWithTag("UnlockedRotation").GetComponent <SpriteRenderer>(); if (lockedRotation != null && unlockedRotation != null) { //Si la rotation contrôlé est active, on desactive la rotation contrôlé par angle RotationController.GetInstance().SetLockRotation(isControlRotation ? false : true); lockedRotation.enabled = isControlRotation ? false : true; unlockedRotation.enabled = isControlRotation ? true : false; isControlRotation = isControlRotation ? false : true; //Pour changer la couleur du label 'angle' (rotation) angleLabel = GameObject.FindWithTag("AngleLabel").GetComponent <TextMeshPro>(); if (angleLabel != null) { angleLabel.color = isControlRotation ? whiteTrans : white; } } }
/***************************************************** * RESET OBJECT ROTATION * * INFO: Remet l'objet avec sa rotation (angles) initiale. * *****************************************************/ public void ResetObjectRotation() { RotationController.GetInstance().ResetObjectRotation(); }