Beispiel #1
0
 void Update()
 {
     if (characterOnRotationMechanism())
     {
         if (rotationActionReminder == null)
         {
             CharacterBehavior character = associatedCase.getMainCharacter();
             if (character.GetComponent <CharacterBehaviorIHM>().isAtStandardScale())
             {
                 GameObject arrow = (GameObject)Instantiate(rotationArrowPrefab, character.transform.position, rotationArrowPrefab.transform.rotation);
                 if (clockwiseRotation)
                 {
                     arrow.GetComponent <SpriteRenderer>().flipX = true;
                 }
                 rotationActionReminder = arrow.transform;
                 rotationActionReminder.SetParent(character.transform);
                 stdScale = arrow.transform.localScale;
                 arrow.transform.localScale = neutralScale;
             }
         }
         else
         {
             if (showRotationAnimationFeedback())
             {
                 rotationActionReminder.localScale = stdScale;
                 if (clockwiseRotation)
                 {
                     angleArrow -= 100.0f * Time.deltaTime;
                 }
                 else
                 {
                     angleArrow += 100.0f * Time.deltaTime;
                 }
                 angleArrow = angleArrow % 360.0f;
                 if (angleArrow < 0)
                 {
                     angleArrow += 360;
                 }
                 rotationActionReminder.rotation = Quaternion.Euler(0, 0, angleArrow);
             }
             else
             {
                 rotationActionReminder.localScale = neutralScale;
             }
         }
     }
     else
     {
         if (rotationActionReminder != null)
         {
             Destroy(rotationActionReminder.gameObject);
         }
     }
 }