Exemplo n.º 1
0
 public void RemoveCreateInteraction(CreateInteraction group)
 {
     group.SetAllPlayersCreating(false);
     group.ResetAllPlayersFriendCounters();
     Destroy(group.GetPreview().gameObject);
     createInteractionList.Remove(group);
     Destroy(group.gameObject);
 }
Exemplo n.º 2
0
    /**Updates the current interacting groups as soon as any player sends a triggerExit event with another player*/

    /*
     * Handles player trigger exiting in creating groups
     * Player trigger exit in moveinteraction takes no effect, since this should be handled via GripPoints Trigger exit
     **/
    //TODO check if above comment is coded correctly
    public void GroupInteractionOnPlayerCollisionExit(Player player1, Player player2)
    {
        CreateInteraction groupInteraction1 = FindPlayerInGroups(player1);

        if (groupInteraction1 != null)
        {
            CreateInteraction groupInteraction2 = FindPlayerInGroups(player2);
            if (groupInteraction2 != null)
            {
                //both players are in the same group
                if (groupInteraction1 == groupInteraction2)
                {
                    //if player1 is still connected to the group
                    if (player1.GetFriendCounter() > 1)
                    {
                        //both players are still connected to the group
                        if (player2.GetFriendCounter() > 1)
                        {
                            //do nothing because the group is the same as before
                        }
                        //only player1 is connected, player2 is leaving
                        else
                        {
                            groupInteraction1.RemovePlayer(player2);
                        }
                    }
                    //only player2 is connected, player1 is leaving
                    else if (player2.GetFriendCounter() > 1)
                    {
                        groupInteraction2.RemovePlayer(player1);
                    }
                    //player1 and player2 are the two players left in the creating group
                    else
                    {
                        groupInteraction1.ResetAllPlayersFriendCounters();
                        RemoveCreateInteraction(groupInteraction1);
                    }
                }
                //players are in different groups (e.g. 2 and 3 players walk over each others triggers)
                else
                {
                    //TODO: handle this or do nothing
                }
            }
            //player1 is part of a "full" group. player2 is not in a group and leaves group from p1
            //else {//do nothing}
        }
        //player1 is not in a group and leaves from WHERE?? is this even possible?
        //else {//do nothing}
    }