Ejemplo n.º 1
0
 public void SetOwner(EPlayerController own)
 {
     if (pView.IsMine)
     {
         pView.RPC("RPC_SetOwner", RpcTarget.All, own.GetComponent <PhotonView>().ViewID);
     }
 }
Ejemplo n.º 2
0
    void OnPlayerListChanged(EPlayerController p, bool isRemove)
    {
        OnLogGame(string.Format("[FF0000]{0}[-]\n", "Người chơi \"" + p.username + "\" đã " + (isRemove ? "rời khởi bàn chơi." : "tham gia bàn chơi.")));
        UITabbarPanel manager = Array.Find <UITabbarPanel>(controller.tabbarPanel, s => s.GetComponent <GPManagerView>() != null);

        manager.GetComponent <GPManagerView>().OnPlayerListChanged(p, isRemove);
    }
Ejemplo n.º 3
0
 public void RPC_OffensiveLeft()
 {
     controllingPlayer         = null;
     controllerPView           = null;
     isOccupied                = false;
     turret.transform.rotation = originalOrientation;
 }
Ejemplo n.º 4
0
 public void RegisterEventRoomMasterChanged(EPlayerController p)
 {
     if (EventRoomMasterChanged != null)
     {
         EventRoomMasterChanged(p);
     }
 }
Ejemplo n.º 5
0
    void SpawnPlayer()
    {
        spawnedPlayer = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PhotonPlayerCharacter"),
                                                  GameObject.FindObjectOfType <GameManager>().GetSpawnLocation(), Quaternion.identity, 0);

        playerController = spawnedPlayer.GetComponent <EPlayerController>();
        playerController.SetNetworkPresence(this, pView.ViewID);
    }
Ejemplo n.º 6
0
    public void Awake()
    {
        gameManager = GameObject.FindObjectOfType <GameManager>();
        player      = gameManager.FetchLocalPlayer();

        highlightedCategoryMaterial = new Material(highlightedCategoryMaterial);
        regularCategoryMaterial     = new Material(regularCategoryMaterial);
    }
Ejemplo n.º 7
0
 private void OnEnable()
 {
     owner           = transform.parent.root;
     player          = owner.GetComponent <EPlayerController>();
     playerCam       = Camera.main;
     isShooting      = false;
     hasEnergyWeapon = false;
     DisableAttackBeam();
 }
Ejemplo n.º 8
0
 public void RPC_SetOwner(int own)
 {
     owner = PhotonView.Find(own).GetComponent <EPlayerController>();
     if (hasProximityDetector)
     {
         GetComponentInChildren <ProximityDetector>().SetOwner(owner);
         GetComponentInChildren <ProximityDetector>().SetStructure(this);
     }
 }
Ejemplo n.º 9
0
 public void ForceStart()
 {
     gameObject.SetActive(true);
     qCurrentCategory  = 0;
     qCurrentSpawnable = 0;
     player            = gameManager.FetchLocalPlayer();
     HighlightQuickSpawnable();
     quickMenu.ShowSelected();
     gameObject.SetActive(false);
 }
Ejemplo n.º 10
0
 public void RegisterKill(EPlayerController deceased, EPlayerController perpetrator)
 {
     foreach (PlayerRecord currRecord in playerRecords)
     {
         //if(currRecord.player == deceased.GetNetworkPresence())
         //{
         //    currRecord.deaths += 1;
         //}
     }
 }
Ejemplo n.º 11
0
    public void RemoveWaitingPlayer(EPlayerController player)
    {
        PlayerWaitingView waitingView = waitingViews.Find(pl => pl.player.username == player.username);

        if (waitingView != null)
        {
            GameObject.Destroy(waitingView.gameObject);
            waitingViews.Remove(waitingView);
            GameManager.Instance.FunctionDelay(delegate() { tableListWaiting.Reposition(); tableListWaiting.transform.parent.GetComponent <UIScrollView>().ResetPosition(); }, 0.001f);
        }
    }
Ejemplo n.º 12
0
 public override void OnSwapSlot(EPlayerController[] listPlayer)
 {
     if (GameModelChan.game != null)
     {
         for (int i = 0; i <= 2; i++)
         {
             EPlayerController p = Array.Find <EPlayerController>(listPlayer, player => player != null && player.mSide == (ESide)(i + 1));
             SetDataPlayer(p, i);
         }
     }
 }
    public static PlayerWaitingInManager Create(EPlayerController player, UIGrid parent, EGPViewManager grandParent)
    {
        GameObject gobj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/PlayerWaiting/PlayerWaitingInManager"));

        gobj.transform.parent        = parent.transform;
        gobj.transform.localPosition = Vector3.zero;
        gobj.transform.localScale    = Vector3.one;
        PlayerWaitingInManager item = gobj.GetComponent <PlayerWaitingInManager>();

        item.grandParent = grandParent;
        item.SetData(player);
        return(item);
    }
Ejemplo n.º 14
0
    public override void SetDataPlayer(EPlayerController p, int i)
    {
        base.SetDataPlayer(p, i);
        int slot = GameModelChan.YourController.slotServer;

        slot += (i + 1);
        if (slot >= 4)
        {
            slot -= 4;
        }

        swappedAvatar[i].gameObject.GetComponent <UIContainerAnonymous>().valueInt = slot;
    }
Ejemplo n.º 15
0
    void SetDataPlayer(EPlayerController p, int i)
    {
        if (p != null)
        {
            UIContainerAnonymous anony = kickButton[i].gameObject.GetComponent <UIContainerAnonymous>();
            if (anony == null)
            {
                anony = kickButton[i].gameObject.AddComponent <UIContainerAnonymous>();
            }
            anony.intermediary = p;
        }

        Texture avatar = null;

        if (p != null)
        {
            p.AvatarTexture(delegate(Texture _texture) { avatar = _texture; });
        }

        string username = p != null ? p.username : "";

        kickAvatar[i].mainTexture = swappedAvatar[i].mainTexture = avatar;

        Color white = Color.white;

        if (p == null)
        {
            white.a = 0f;
        }
        kickAvatar[i].color = swappedAvatar[i].color = white;

        kickUsername[i].text = swappedUsername[i].text = username;

        kickButton[i].gameObject.SetActive(p != null);
        kickAvatar[i].gameObject.SetActive(p != null);

        int slot = GameModelChan.YourController.slotServer;

        slot += (i + 1);
        if (slot >= 4)
        {
            slot -= 4;
        }

        swappedAvatar[i].gameObject.GetComponent <UIContainerAnonymous>().valueInt = slot;
    }
Ejemplo n.º 16
0
    public override void OnPlayerListChanged(EPlayerController p, bool isRemove)
    {
        if (isRemove)
        {
            if (p.mSide == ESide.None)
            {
                PlayerWaitingInManager playerView = waitingPlayers.Find(plc => plc.player.username == p.username);
                if (playerView != null)
                {
                    GameObject.Destroy(playerView.gameObject);
                    waitingPlayers.Remove(playerView);
                }
                GameManager.Instance.FunctionDelay(delegate() { gridWaitingPlayer.Reposition(); }, 0.01f);
            }
            else
            {
                if (GameModelChan.CurrentState == GameModelChan.EGameState.waitingForPlayer || GameModelChan.CurrentState == GameModelChan.EGameState.waitingForReady)
                {
                    int i = ((int)p.mSide - 1);
                    kickAvatar[i].mainTexture = swappedAvatar[i].mainTexture = null;
                    kickAvatar[i].color       = swappedAvatar[i].color = Color.black;
                    kickUsername[i].text      = swappedUsername[i].text = "";
                    kickButton[i].gameObject.SetActive(false);
                }
            }
        }
        else
        {
            if (p.mSide == ESide.None)
            {
                waitingPlayers.Add(PlayerWaitingInManager.Create(p, gridWaitingPlayer, this));
                gridWaitingPlayer.Reposition();
            }
            else
            {
                int i = 0;
                if (p.mSide != ESide.Slot_0)
                {
                    i = ((int)p.mSide - 1);
                }

                SetDataPlayer(p, i);
            }
        }
    }
Ejemplo n.º 17
0
 public Meld(int[] lst, EPlayerController p)
 {
     player = p;
     foreach (int value in lst)
     {
         ECard card = p.mCardHand.Find(c => c.CardId == value);
         if (card == null)
         {
             card = p.mCardHand.Find(c => c.CardId == -1);
             if (card != null)
             {
                 card.CardId = value;
             }
         }
         p.mCardHand.Remove(card);
         meld.Add(card);
     }
 }
Ejemplo n.º 18
0
 public void RegisterEventPlayerListChanged(EPlayerController p, bool isRemove)
 {
     if (EventPlayerListChanged != null && GameObject.Find("__Prefab Manager Gameplay") != null)
     {
         EventPlayerListChanged(p, isRemove);
     }
     else
     {
         if (GameManager.CurrentScene == ESceneName.GameplayChan)
         {
             GPInformationView.listMessage.Add(string.Format("[FF0000]{0}[-]\n", "Người chơi \"" + p.username + "\" đã " + (isRemove ? "rời khởi bàn chơi." : "tham gia bàn chơi.")));
         }
         else if (GameManager.CurrentScene == ESceneName.GameplayPhom)
         {
             GPInformationViewPhom.listMessage.Add(string.Format("[FF0000]{0}[-]\n", "Người chơi \"" + p.username + "\" đã " + (isRemove ? "rời khởi bàn chơi." : "tham gia bàn chơi.")));
         }
         else if (GameManager.CurrentScene == ESceneName.GameplayTLMN)
         {
             GPInformationViewTLMN.listMessage.Add(string.Format("[FF0000]{0}[-]\n", "Người chơi \"" + p.username + "\" đã " + (isRemove ? "rời khởi bàn chơi." : "tham gia bàn chơi.")));
         }
     }
 }
Ejemplo n.º 19
0
 IEnumerator CheckForEnemies()
 {
     while (true)
     {
         playerToAttack = null;
         Collider[] everyoneInRange = Physics.OverlapSphere(transform.position, 40, 1 << 16);
         if (everyoneInRange.Length > 0)
         {
             foreach (Collider currCol in everyoneInRange)
             {
                 if (currCol.GetComponent <EPlayerController>().GetNetworkID() != GetOwner().GetNetworkID())
                 {
                     playerToAttack = currCol.GetComponent <EPlayerController>();
                     break;
                 }
             }
             if (playerToAttack)
             {
                 PerformAttack();
             }
         }
         yield return(new WaitForSeconds(1.0f / frequency));
     }
 }
Ejemplo n.º 20
0
    public virtual void SetDataPlayer(EPlayerController p, int i)
    {
        if (p != null)
        {
            UIContainerAnonymous anony = kickButton[i].gameObject.GetComponent <UIContainerAnonymous>();
            if (anony == null)
            {
                anony = kickButton[i].gameObject.AddComponent <UIContainerAnonymous>();
            }
            anony.intermediary = p;
        }

        Texture avatar = null;

        if (p != null)
        {
            p.AvatarTexture(delegate(Texture _texture) { avatar = _texture; });
        }

        string username = p != null ? p.username : "";

        kickAvatar[i].mainTexture = swappedAvatar[i].mainTexture = avatar;

        Color white = Color.white;

        if (p == null)
        {
            white.a = 0f;
        }
        kickAvatar[i].color = swappedAvatar[i].color = white;

        kickUsername[i].text = swappedUsername[i].text = username;

        kickButton[i].gameObject.SetActive(p != null);
        kickAvatar[i].gameObject.SetActive(p != null);
    }
Ejemplo n.º 21
0
 public void RegisterKill(EPlayerController deceased)
 {
 }
Ejemplo n.º 22
0
    //private void OnTriggerEnter(Collider other)
    //{
    //    if (!owner || !GetComponentInParent<SpawnableGO>().isUsable)
    //    {
    //        return;
    //    }

    //    if (other.GetComponent<EPlayerController>() && other.GetComponent<EPlayerController>() != owner)
    //    {
    //        structure.OpponentDetected(other.GetComponent<EPlayerController>());
    //    }
    //}

    //private void OnTriggerExit(Collider other)
    //{
    //    if (other.GetComponent<EPlayerController>())
    //    {
    //        structure.OpponentLeft(other.GetComponent<EPlayerController>());
    //    }
    //}

    public void SetOwner(EPlayerController own)
    {
        owner = own;
    }
Ejemplo n.º 23
0
    public void SpawnSpawnable(SpawnableType type, string id, Vector3 location, Quaternion rotation, EPlayerController owner)
    {
        Spawnable receivedBlueprint = GetBlueprint(type, id);

        //GameObject spawnedSpawnable = Instantiate(receivedBlueprint.prefab, location, rotation);
        GameObject spawnedSpawnable = PhotonNetwork.Instantiate(Path.Combine(receivedBlueprint.pathStrings), location,
                                                                receivedBlueprint.isGridAligned?GetGridAlignedRotation(rotation):rotation, 0);

        spawnedSpawnable.GetComponent <SpawnableGO>().displayName = receivedBlueprint.displayName;
        if (spawnedSpawnable.GetComponent <SpawnableHealth>())
        {
            spawnedSpawnable.GetComponent <SpawnableHealth>().InitiateSystems(receivedBlueprint.health);
        }

        if (spawnedSpawnable.GetComponent <DefensiveBase>())
        {
            spawnedSpawnable.GetComponent <DefensiveBase>().SetOwner(owner);
        }
    }
Ejemplo n.º 24
0
 void Start()
 {
     playerController = GetComponentInParent <EPlayerController>();
 }
Ejemplo n.º 25
0
 public virtual void OnPlayerListChanged(EPlayerController p, bool isRemove)
 {
 }
Ejemplo n.º 26
0
 public void SetControllingPlayer(EPlayerController controller)
 {
     controllingPlayer = controller;
 }
Ejemplo n.º 27
0
    public void OffensiveOccuppied(EPlayerController controller)
    {
        int tID = controller.GetComponent <PhotonView>().ViewID;

        pView.RPC("RPC_OffensiveOccupied", RpcTarget.All, tID);
    }
 public void SetData(EPlayerController player)
 {
     this.player = player;
     StartCoroutine(_SetData());
 }
Ejemplo n.º 29
0
 public void RPC_OffensiveOccupied(int controller)
 {
     controllingPlayer = PhotonView.Find(controller).GetComponent <EPlayerController>();
     controllerPView   = PhotonView.Find(controller).GetComponent <PhotonView>();
     isOccupied        = true;
 }
Ejemplo n.º 30
0
 public void SetOwner(EPlayerController tPlayer)
 {
     player = tPlayer;
 }