// Use this for initialization
 void Start()
 {
     player = transform.parent.GetComponent <RpsHumanPlayer>();
     if (!player.isLocalPlayer)
     {
         this.gameObject.SetActive(false);
         //Destroy(this.gameObject);
         return;
     }
     view = player.GetComponentInChildren <MatchPlayerUI>();
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        player = transform.parent.GetComponent <RpsHumanPlayer>();
        if (!player.isLocalPlayer)
        {
            this.gameObject.SetActive(false);
            //Destroy(this.gameObject);
            return;
        }
        player.OnMatchRequest += DisplayMatchRequest;
        player.OnMatchStart   += DisplayHumanMatchUI;
        player.OnMatchEnd     += DisplayMatchResults;
        //TODO:
        //player.OnMatchRequestResponse += something
        player.OnObserveMatch += DisplayObservationMatch;

        matchResultAnimation = -1.0f;

        HandUI[] hands = this.GetComponentsInChildren <HandUI>();
        foreach (HandUI h in hands)
        {
            if (h is HumanHandUI)
            {
                humanHand = h as HumanHandUI;
                humanHand.Initialize(player);
            }
            if (h.dir == Direction.North)
            {
                northHand = h;
            }
            else
            {
                southHand = h;
            }
        }
        humanHand.gameObject.SetActive(false);
        northHand.gameObject.SetActive(false);
        southHand.gameObject.SetActive(false);

        tableBackdropImage = this.transform.FindChild("TableBackdrop").GetComponent <Image>();
        northHandLabels    = this.transform.FindChild("NorthInfo").gameObject;
        southHandLabels    = this.transform.FindChild("SouthInfo").gameObject;
        SetMatchUIActive(false);
    }
 public void Initialize(RpsHumanPlayer player)
 {
     humanPlayer   = player;
     this.player   = player;
     this.isHidden = false;
 }
 public void Initialize(RpsHumanPlayer localPlayer, RpsAgent initiator, float timeout)
 {
     this.localPlayer = localPlayer;
     this.initiator   = initiator;
     this.timeout     = timeout;
 }