/*
     * A Flip is required if everyone is on screen, and everyone is near one of the edges.
     */
    FlipStates RequiredFlip()
    {
        FlipStates check = FlipStates.NO;

        foreach (GameObject townie in groupMembers)
        {
            // Automatically fail if there is anyone off screen
            if (townie.GetComponent <VisibilityTracker>().checkVisible() == false)
            {
                return(FlipStates.NO);
            }

            // For the remainig ones, set based on whether everyone is in the same sector or not.
            if (townie.GetComponent <VisibilityTracker>().getCurrentScreenSector().x >= (gc.screenDivisions - 1))
            {
                check = FlipStates.RIGHT;
            }
            if (townie.GetComponent <VisibilityTracker>().getCurrentScreenSector().x < 1)
            {
                check = FlipStates.LEFT;
            }
        }

        return(check);
    }
 // Update is called once per frame
 void Update()
 {
     if (myFollow.EnableConversationLook())
     {
         FlipStates flipTo = RequiredFlip();
         if (flipTo == FlipStates.LEFT)
         {
             foreach (GameObject townie in groupMembers)
             {
                 Debug.Log("Flipping the townie named " + townie.transform.name);
                 townie.GetComponent <SpriteRenderer>().flipX = LeftLookValue;
             }
         }
         else if (flipTo == FlipStates.RIGHT)
         {
             foreach (GameObject townie in groupMembers)
             {
                 Debug.Log("Flipping the townie named " + townie.transform.name);
                 townie.GetComponent <SpriteRenderer>().flipX = !LeftLookValue;
             }
         }
         else
         {
             int i = 0;
             foreach (GameObject townie in groupMembers)
             {
                 townie.GetComponent <SpriteRenderer>().flipX = initialDirections[i];
                 i++;
             }
         }
     }
 }
Exemplo n.º 3
0
 void Update()
 {
     if (targetState != currentState)
     {
         StopCoroutine(currentState.ToString());
         currentState = targetState;
         StartCoroutine(currentState.ToString());
     }
     SetScore();
 }
Exemplo n.º 4
0
 public void SetState(FlipStates state)
 {
     targetState = state;
 }