コード例 #1
0
    protected virtual void OnTriggerExit(Collider other)
    {/*
      * Debug.Log("OTHER ELEMENT OnTriggerExit: " + other.gameObject);
      *
      * if (other.tag == "Overlap" && (state == ElementState.MOVE || state == ElementState.ROTATE))
      * {
      *     overlappedElements--;
      *     if (overlappedElements == 0)
      *     {
      *         ChangeError(ErrorState.NONE);
      *     }
      * }*/
        AbstractOpticalElement opticalElement = other.gameObject.GetComponent <AbstractOpticalElement>();
        Lampport  lampPort  = other.gameObject.GetComponent <Lampport>();
        StartLens startLens = other.gameObject.GetComponent <StartLens>();

        // Ended Collision with another OpticalElement or Lampport
        if (opticalElement || lampPort || startLens)
        {
            if (overlappedElements == 0 && (state == ElementState.MOVE || state == ElementState.ROTATE))
            {
                overlappedElements--;
                ChangeError(ErrorState.NONE);
            }
        }
    }
コード例 #2
0
    public RotationInteraction AddRotationInteraction(AbstractOpticalElement opticalElement, Player player)
    {
        RotationInteraction newRotationInteraction = Instantiate(RIPrefab);

        newRotationInteraction.SetProperties(player, opticalElement);
        rotationInteractionList.Add(newRotationInteraction);
        return(newRotationInteraction);
    }
コード例 #3
0
    /**Updates the current interacting groups as soon as any player sends a triggerExit event with another player*/

    /*
     * public void GroupInteractionOnPlayerCollisionExit(Player player1, Player player2)
     * {
     *  GroupInteraction groupInteraction1 = FindPlayerInGroups(player1);
     *  if (groupInteraction1 != null)
     *  {
     *      GroupInteraction groupInteraction2 = FindPlayerInGroups(player2);
     *      if (groupInteraction2 != null)
     *      {
     *          //both players are in the same group, and it is a CREATING group
     *          if (groupInteraction1 == groupInteraction2 && groupInteraction1.GetComponent<CreateInteraction>())
     *          {
     *              //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();
     *                  groupInteraction1.SetAllPlayersAvailable(true);
     *                  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}
     * }
     */

    public void AddMoveInteraction(AbstractOpticalElement opticalElement, Player[] players)
    {
        Debug.Log("AddMoveInteraction");
        MoveInteraction newGroupInteraction = Instantiate(MIPrefab);

        newGroupInteraction.SetProperties(players, opticalElement);
        moveInteractionList.Add(newGroupInteraction);
    }
コード例 #4
0
 public override void SetProperties(Player[] newPlayers, AbstractOpticalElement opticalElement)
 {
     players = newPlayers;
     SetAllPlayersAvailable(false);
     this.opticalElement = opticalElement;
     foreach (Player p in players)
     {
         p.SetConnectionPoint(new Vector3(midpoint.x, floorHeight, midpoint.y));
     }
 }
コード例 #5
0
 public void SetProperties(Player player, AbstractOpticalElement element)
 {
     if (player == null) //error on creation
     {
         interactionManager.RemoveRotationInteraction(this);
     }
     else
     {
         this.player        = player;
         player.isAvailable = false;
         opticalElement     = element;
     }
 }
コード例 #6
0
    public virtual void OnTriggerEnter(Collider other)
    {/*
      * Debug.Log("ontriggerenter");
      * Debug.Log("OTHER ELEMENT OnTriggerEnter: " + other.gameObject);
      *
      * if (other.tag == "Overlap" && (state == ElementState.MOVE || state == ElementState.ROTATE))
      * {
      *     overlappedElements++;
      *     ChangeError(ErrorState.ERROROVERLAP);
      * }*/
        AbstractOpticalElement opticalElement = other.gameObject.GetComponent <AbstractOpticalElement>();
        Lampport  lampPort  = other.gameObject.GetComponent <Lampport>();
        StartLens startLens = other.gameObject.GetComponent <StartLens>();

        // Collision with another OpticalElement or Lampport
        if (opticalElement || lampPort || startLens)
        {
            if (overlappedElements == 0 && (state == ElementState.MOVE || state == ElementState.ROTATE))
            {
                overlappedElements++;
                ChangeError(ErrorState.ERROROVERLAP);
            }
        }
    }
コード例 #7
0
 public abstract void SetProperties(Player[] newPlayers, AbstractOpticalElement opticalElement);
コード例 #8
0
 void Awake()
 {
     aoe = transform.GetComponentInParent <AbstractOpticalElement>();
 }
コード例 #9
0
 public void SetProperties(Player player, AbstractOpticalElement element)
 {
     this.player        = player;
     player.isAvailable = false;
     opticalElement     = element;
 }
コード例 #10
0
ファイル: GripPoints.cs プロジェクト: sophie333/CityLights
    /* //if we had dedicated grippoint-to-player connections:
     * //private GripPoints[] gripPoints;
     * private bool isActive;
     * private Player inputPlayer;**/

    public void Awake()
    {
        //gripPoints = transform.parent.GetComponentsInChildren<GripPoints>();
        aoe = transform.GetComponentInParent <AbstractOpticalElement>();
    }
コード例 #11
0
 public override void SetProperties(Player[] newPlayers, AbstractOpticalElement opticalElement)
 {
     //TODO?
 }
コード例 #12
0
 public override void SetProperties(Player[] newPlayers, AbstractOpticalElement opticalElement)
 {
     players = newPlayers;
     this.SetAllPlayersAvailable(false);
     this.opticalElement = opticalElement;
 }