Exemple #1
0
    void Start()
    {
        melee  = new Weapon();
        ranged = new Weapon();

        PhotonConnection.GetInstance().playerList.Add(this);
        if (photonView.isMine)
        {
            Camera.main.transform.parent        = transform;
            Camera.main.transform.localPosition = Vector3.zero;
            Camera.main.transform.localPosition = new Vector3(0, 8, -25);
        }

        InitBaseWeapons(melee, ranged); // common
        //InitRandomWeapons(melee, ranged); // random
        DebugWeapons(melee, ranged);

        facingRight      = false;
        player_rigidbody = GetComponent <Rigidbody>();
        _myPlayerStats   = GetComponent <PlayerStats>();

        //hit box is deactivated unless the player hits
        BasicHitBox.GetComponent <MeshRenderer>().enabled = false;
        BasicHitBox.GetComponent <Collider>().enabled     = false;
    }
Exemple #2
0
    void InitRandomWeapons(Weapon melee, Weapon ranged)
    {
        melee.rarity = (Items.WeaponRarity)Random.Range(1, 5);
        melee.sprite = meleeSprites[(int)melee.rarity];
        melee.stats  = WeaponStats.SetStats(melee.stats, PhotonConnection.GetInstance().randomSeed, melee.type, melee.rarity);

        ranged.rarity = (Items.WeaponRarity)Random.Range(1, 5);
        ranged.sprite = rangedSprites[(int)ranged.rarity];
        ranged.stats  = WeaponStats.SetStats(ranged.stats, PhotonConnection.GetInstance().randomSeed, ranged.type, ranged.rarity);

        if ((int)melee.rarity > 1)
        {
            WeaponStats.SetMeleeModifier(ref melee.stats, melee.stats.mod1);
            if (melee.rarity != Items.WeaponRarity.RARE)
            {
                WeaponStats.SetMeleeModifier(ref melee.stats, melee.stats.mod2);
            }
        }

        if ((int)ranged.rarity > 1)
        {
            WeaponStats.SetMeleeModifier(ref ranged.stats, ranged.stats.mod1);
            if (ranged.rarity != Items.WeaponRarity.RARE)
            {
                WeaponStats.SetMeleeModifier(ref ranged.stats, ranged.stats.mod2);
            }
        }
    }
    IEnumerator SendColor()
    {
        yield return(new WaitForSeconds(1));

        object[] parameters = new object[2];
        parameters[1] = PhotonConnection.GetInstance().myColor;
        parameters[0] = PhotonConnection.GetInstance().ownPlayer.GetComponent <PhotonView>().ownerId;
        PhotonNetwork.RPC(GetComponent <PhotonView>(), "ChangeColor", PhotonTargets.AllBuffered, false, parameters);
    }
Exemple #4
0
 void OnTriggerStay(Collider objeto)
 {
     if (objeto.CompareTag("Melee") || objeto.CompareTag("Rango"))
     {
         if (Input.GetKeyDown(KeyCode.E))
         {
             WeaponPickup weapon = objeto.GetComponent <WeaponPickup>();
             ChangeWeapon(weapon.type, weapon.rarity, PhotonConnection.GetInstance().randomSeed);
         }
     }
 }
Exemple #5
0
    void InitBaseWeapons(Weapon melee, Weapon ranged)
    {
        melee.type   = Items.WeaponType.MELEE;
        melee.rarity = Items.WeaponRarity.COMMON;
        melee.sprite = meleeSprites[(int)melee.rarity];
        melee.stats  = WeaponStats.SetStats(melee.stats, PhotonConnection.GetInstance().randomSeed, melee.type, melee.rarity);

        ranged.type   = Items.WeaponType.RANGED;
        ranged.rarity = Items.WeaponRarity.COMMON;
        ranged.sprite = meleeSprites[(int)ranged.rarity];
        ranged.stats  = WeaponStats.SetStats(ranged.stats, PhotonConnection.GetInstance().randomSeed, ranged.type, ranged.rarity);
    }
    public void ChangeColor(object[] _parameters)
    {
        COLOR c  = (COLOR)_parameters[1];
        int   id = (int)_parameters[0];

        for (int i = 0; i < PhotonConnection.GetInstance().playerList.Count; i++)
        {
            if (PhotonConnection.GetInstance().playerList[i] != null)
            {
                if (PhotonConnection.GetInstance().playerList[i].photonView.ownerId == id)
                {
                    PhotonConnection.GetInstance().playerList[i].ChangeColorByName(c);
                }
            }
        }
    }