Пример #1
0
    public void RemoveRotationInteraction(RotationInteraction rotationInteraction)
    {
        Debug.Log("RemoveRotationInteraction");

        if (rotationInteraction.GetPlacedObject())
        {
            if (rotationInteraction.player != null)
            {
                StartCoroutine(rotationInteraction.player.DelayIsAvailableTrue());
            }
            else
            {
                Debug.Log("Player on RotationInteraction Destroy was NULL");
                //TODO handle null-player interactions
            }
        }
        else
        {
            rotationInteraction.player.isAvailable = true;
            rotationInteraction.player.ResetFriendCounter();
        }

        rotationInteractionList.Remove(rotationInteraction);
        DestroyImmediate(rotationInteraction.gameObject);
    }
Пример #2
0
    public void AddRotationInteraction(AbstractOpticalElement opticalElement, Player player)
    {
        RotationInteraction newRotationInteraction = Instantiate(RIPrefab);

        newRotationInteraction.SetProperties(player, opticalElement);
        rotationInteractionList.Add(newRotationInteraction);
    }
Пример #3
0
    public virtual void Update()
    {
        int previousPlayersActive = playersActive;

        playersActive = 0;
        //handle players gone missing
        for (int i = 0; i < max_PlayerNr; i++)
        {
            if (playerArray[i] != null)
            {
                playersActive++;
            }
        }
        if (previousPlayersActive != playersActive)
        {
            CheckPlayerNr();
        }

        //ROTATE Mode: 1 Player
        if (playersActive == 1 && state != ElementState.ROTATE && state != ElementState.DESTROY && !(this is Lens))
        {
            if (Time.time - timeEntered > logInTime)
            {
                Debug.Log("ROTATE Mode activated");
                Debug.Log("Player :" + playerArray[0] + " added.");
                ChangeState(ElementState.ROTATE);
                rotInt      = interactionManager.AddRotationInteraction(this, FindRotatingPlayer());
                timeEntered = 360000f; //TODO find a way to check time correctly
            }
        }
    }
Пример #4
0
 public void ClearInteractions()
 {
     if (rotInt != null)
     {
         interactionManager.RemoveRotationInteraction(rotInt);
         rotInt = null;
     }
     if (movInt != null)
     {
         interactionManager.RemoveMoveInteraction(movInt);
         movInt = null;
     }
 }
Пример #5
0
    public void RemoveRotationInteraction(RotationInteraction rotInt)
    {
        // reset place animation
        rotInt.opticalElement.waitCircle.fillAmount = 0;

        rotationInteractionList.Remove(rotInt);

        bool placed = rotInt.PlaceObject();

        if (placed)
        {
            rotInt.StartCoroutine(rotInt.DelayedDestroy());
        }
        else
        {
            Destroy(rotInt);
        }
    }