Ejemplo n.º 1
0
 public void ChangePortrait(string Pname, uLink.NetworkPlayer owner, Sprite neutral, bool empty)
 {
     if (empty)
     {
         networkOwner     = owner;
         NameBox.text     = "Free Slot";
         CharNameBox.text = "";
         StatusBox.text   = "";
         ChangeSprite(slotEmpty);
         isEmpty = true;
     }
     else
     {
         CharNameBox.text = charName.ToString();
         if (!isReady)
         {
             StatusBox.text = "Picking";
         }
         else
         {
             StatusBox.text = "Ready";
         }
         networkOwner = owner;
         NameBox.text = Pname;
         ChangeSprite(neutral);
         isEmpty = false;
     }
 }
Ejemplo n.º 2
0
    //METHOD USED TO DEAL DMG TO A OBJ DESTINATION
    public void MobaDealDamage(GameObject obj)
    {
        if (photonView.isMine)
        {
            if (obj.tag == "RedPlayerTag" && team == "blue" || obj.tag == "BluePlayerTag" && team == "red")
            {
                expended = true;


                PlayerStats playerStatsScript = obj.GetComponent <PlayerStats>();
                //statsScript.DrainHealthPhoton(ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                playerStatsScript.photonView.RPC("DrainHealth", playerStatsScript.photonView.owner, ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                if (buffDebuff.isSlow)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server,buffDebuff.slowObj ,buffDebuff.slowObj ,buffDebuff.slowObj , transform.position,transform.rotation, 0,
                    // "slow", myOriginator, transform.position, destinationGameObj.name, buffDebuff.slowValue, buffDebuff.slowTime);
                }
                if (buffDebuff.isStun)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server, buffDebuff.stunObj,buffDebuff.stunObj,buffDebuff.stunObj, transform.position,transform.rotation, 0,
                    // "stun", myOriginator, transform.position, destinationGameObj.name, buffDebuff.stunTime, 0);
                }
            }

            if (obj.tag == "CreepTag" || obj.tag == "RedTeamTag" && team == "blue" || obj.tag == "BlueTeamTag" && team == "red")
            {
                expended = true;

                Debug.Log(obj.name + "  " + obj.tag);
                PlayerStats playerStatsScript = obj.GetComponent <PlayerStats>();
                //statsScript.DrainHealthMaster(ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                playerStatsScript.photonView.RPC("DrainHealth", photonView.owner, ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                if (buffDebuff.isSlow)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server,buffDebuff.slowObj ,buffDebuff.slowObj ,buffDebuff.slowObj , transform.position,transform.rotation, 0,
                    // "slow", myOriginator, transform.position, destinationGameObj.name, buffDebuff.slowValue, buffDebuff.slowTime);
                }
                if (buffDebuff.isStun)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server, buffDebuff.stunObj,buffDebuff.stunObj,buffDebuff.stunObj, transform.position,transform.rotation, 0,
                    // "stun", myOriginator, transform.position, destinationGameObj.name, buffDebuff.stunTime, 0);
                }
            }
            if (obj.tag == "RedPlayerTriggerTag" && team == "blue" || obj.tag == "BluePlayerTriggerTag" && team == "red")
            {
                expended = true;
                GameObject enemy = (GameObject)obj.transform.gameObject;

                PlayerStats playerStatsScript = enemy.transform.parent.GetComponent <PlayerStats>();
                //playerStatsScript.DrainHealthPhoton(ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                playerStatsScript.photonView.RPC("DrainHealth", playerStatsScript.photonView.owner, ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                //playerStatsScript.DrainHealth(ad, ap, myOriginator,originatorGameObj, originatorGameObj.tag, originatorCharName);



                if (buffDebuff.isSlow)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server, buffDebuff.slowObj,buffDebuff.slowObj,buffDebuff.slowObj, transform.position,transform.rotation, 0,
                    //  "slow", myOriginator, transform.position, enemy.transform.parent.name, buffDebuff.slowValue, buffDebuff.slowTime);
                }

                if (buffDebuff.isStun)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server, buffDebuff.stunObj,buffDebuff.stunObj,buffDebuff.stunObj, transform.position,transform.rotation, 0,
                    //   "stun", myOriginator, transform.position, enemy.transform.parent.name, buffDebuff.stunTime, 0);
                }
            }

            if (obj.tag == "CreepTriggerTag" || obj.tag == "RedTeamTriggerTag" && team == "blue" || obj.tag == "BlueTeamTriggerTag" && team == "red")
            {
                expended = true;
                GameObject enemy = (GameObject)obj.transform.gameObject;

                PlayerStats playerStatsScript = enemy.transform.parent.GetComponent <PlayerStats>();
                playerStatsScript.photonView.RPC("DrainHealth", playerStatsScript.photonView.owner, ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                //playerStatsScript.DrainHealthMaster(ad, ap, myOriginator, originatorGameObj.tag, originatorCharName.ToString());
                //playerStatsScript.DrainHealth(ad, ap, myOriginator,originatorGameObj, originatorGameObj.tag, originatorCharName);



                if (buffDebuff.isSlow)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server, buffDebuff.slowObj,buffDebuff.slowObj,buffDebuff.slowObj, transform.position,transform.rotation, 0,
                    //  "slow", myOriginator, transform.position, enemy.transform.parent.name, buffDebuff.slowValue, buffDebuff.slowTime);
                }

                if (buffDebuff.isStun)
                {
                    //uLink.Network.Instantiate(uLink.NetworkPlayer.server, buffDebuff.stunObj,buffDebuff.stunObj,buffDebuff.stunObj, transform.position,transform.rotation, 0,
                    //   "stun", myOriginator, transform.position, enemy.transform.parent.name, buffDebuff.stunTime, 0);
                }
            }
        }
    }
Ejemplo n.º 3
0
    public void DrainHealthMasterOLD(float _ad, float _ap, string attacker, string originatorTag, string originatorCharName)
    {
        if (PhotonNetwork.isMasterClient)
        {
            GameObject originatorObj = GameObject.Find(attacker);
            if (!destroyed)
            {
                myHealth = myHealth - GetFinalDmg(_ad, _ap, adRes + adResAdd, apRes + apResAdd);
                if (originatorObj.tag == "RedPlayerTag" || originatorObj.tag == "BluePlayerTag")
                {
                    AddCaptureAttackers(attacker, originatorObj, Time.time);
                }
            }

            if (myHealth <= 0 && destroyed == false)
            {
                myHealth  = 0;
                destroyed = true;
                photonView.RPC("ImDead", PhotonTargets.All);
                for (int i = 0; i < dataScript.PlayerList.Count; i++)
                {
                    if (dataScript.PlayerList[i].playerName == attacker)
                    {
                        photonView.RPC("ShowGoldUi", dataScript.PlayerList[i].networkPlayer, this.transform.name, attacker, goldToGive, true);
                    }
                }

                for (int i = 0; i < attackersList.Count; i++)                 // Loop with for.
                {
                    attackersList[i]._Obj.GetComponent <PlayerStats>().UpdateExpToClients(expToGive / attackersList.Count);
                    attackersList[i]._Obj.GetComponent <PlayerStats>().UpdateGoldToClients(goldToGive / attackersList.Count);
                }

                if (gameObject.tag == "RedPlayerTag" || gameObject.tag == "BluePlayerTag")
                {
                    //call the method SendSlainAlert(); on GAME MANAGER
                    CharacterClass.charName thisCharName = GetComponent <PlayerStats>().stats.characterName;
                    gameManager.GetComponent <GameEvents>().SendSlainAlert(originatorCharName, attacker, thisCharName.ToString(), this.gameObject.name);
                }

                if (originatorTag == "RedPlayerTag" || originatorTag == "BluePlayerTag")
                {
                    //If the reciever  is a player
                    if (gameObject.tag == "RedPlayerTag" || gameObject.tag == "BluePlayerTag")
                    {
                        dataScript.EditPlayerListWithScore(attacker);
                        PlayerStats originatorPlayerScript = originatorObj.GetComponent <PlayerStats>();
                        originatorPlayerScript.AddPlayerKills();
                    }
                    else
                    //If the  reciever is not a player
                    {
                        //ADD HERE THE CODE IF YOU KILL A MONSTER /TOWER / MINION
                    }
                }
            }
        }
        else
        {
            photonView.RPC("DrainHealthPhoton", PhotonTargets.MasterClient, _ad, _ap, attacker, originatorTag, originatorCharName);
        }
    }