Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'photon weapon sync'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. Hello all, from past 6 days i am trying to sync selected weapons over network in my game... but i failed... i am using AU Fps kit and its weapon manager... but i want to sync the selected weapon that others will see on my network character holding it... here is little try i did.. but failed...please help me..!!! Thanks #pragma strict class NetworkWeaponManager extends Photon.MonoBehaviour { private var P_Weapon : int; private var S_Weapon : int; public var weaponsInUse : GameObject[]; // used weapons, among which you can switch. public var weaponsInGame : GameObject[]; public var weaponToSelect : int; var pw : PhotonView; function Start () { if(PlayerPrefs.HasKey("Selected_P")) { P_Weapon = PlayerPrefs.GetInt("Selected_P"); weaponsInUse[0] = weaponsInGame[P_Weapon]; } if(PlayerPrefs.HasKey("Selected_S")) { S_Weapon = PlayerPrefs.GetInt("Selected_S"); weaponsInUse[1] = weaponsInGame[S_Weapon]; } DeselectWeapon(); } function FixedUpdate() { if (photonView.isMine) { weaponToSelect = ToSelect; DeselectWeapon(); } else { DeselectWeapon(); } } function DeselectWeapon(){ //Dectivate all weapon for (var i : int = 0; i < weaponsInUse.length; i++){ weaponsInUse[i].SetActive(false); } SelectWeapon(weaponToSelect); } function SelectWeapon (i : int) { //Activate selected weapon weaponsInUse[i].SetActive(true); // Debug.Log("WeaponSelected"); } private var ToSelect : int; function OnPhotonSerializeView ( stream : PhotonStream, info : PhotonMessageInfo ) { if (stream.isWriting){ stream.SendNext(weaponToSelect); } else { ToSelect = stream.ReceiveNext(); } } } i am not good at scripting.... my Local Weapon Manager assigns the weaponToSelect variable of NetworkWeaponManager like this Declared a variable var NetWorkWeapons : NetworkWeaponManager; Assigning Values function Update () { if (Input.GetButtonDown("1") && weaponsInUse.length >= 1 && canSwitch && weaponToSelect != 0) { DeselectWeapon(); weaponToSelect = 0; NetWorkWeapons.weaponToSelect = 0; } //calling function at NetworkWeaponManager to Deselect the weapon NetWorkWeapons.DeselectWeapon(); } Thanks in Advance
×
×
  • Create New...