public void ServerUpdate() { CharProfile myProfile = GetComponent <CharProfile>(); if (!myProfile.isAlive) { //print("name: " + myProfile.playerName + ", before " + myProfile.revive_helpers.Count); //for (int i = myProfile.revive_helpers.Count-1; i >= 0; i--) { if (myProfile.revive_helpers[i] == null) myProfile.revive_helpers.RemoveAt(i); } //print("name: " + myProfile.playerName + ", after " + myProfile.revive_helpers.Count); if (myProfile.revive_helpers.Count >= 2) { //print("timer: " + Time.time + " - " + myProfile.revive_timer); if (myProfile.revive_timer == 0) { myProfile.revive_timer = Time.time; } else if (Time.time - myProfile.revive_timer > 10.0f) { myProfile.revive_timer = 0; myProfile.CmdReviveSuccess(); } } else { myProfile.revive_timer = 0; } } }
private void Initialize() { try { Util.WriteToChat("Loading profile"); //Find profiles MasterProfile = Profile.GetProfile(); CharProfile = MasterProfile.GetCharacterProfile(); //Set up command parser SetupCommandParser(); //Start experience policy CharProfile.Policy.Start(MasterProfile.Interval); //Start spell manager spellManager = new SpellTabManager(); spellManager.Start(MasterProfile.Interval); //Watch for changes to profiles masterProfileWatcher = new FileSystemWatcher() { Path = System.IO.Path.GetDirectoryName(Profile.ConfigurationPath), Filter = System.IO.Path.GetFileName(Profile.ConfigurationPath), EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite, }; charProfileWatcher = new FileSystemWatcher() { Path = System.IO.Path.GetDirectoryName(CharProfile.Path), Filter = System.IO.Path.GetFileName(CharProfile.Path), EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite, }; if (isFirstLogin) { //Run login commands CharProfile.ExecuteLoginCommands(); //Add events if they haven't already been added Globals.Core.CommandLineText += Core_CommandLineText; masterProfileWatcher.Changed += RequestReload; charProfileWatcher.Changed += RequestReload; isFirstLogin = false; } } catch (Exception ex) { Util.LogError(ex); } }
private void RpcReviveChar(bool startRevive, NetworkIdentity myTargetID) { CharProfile a = myTargetID.gameObject.GetComponent <CharProfile>(); //da li počinjemo revive ili prestajemo if (startRevive) { //je li ovaj igrač ubrojan kao reviver ako nije ubroji ga if (!a.revive_helpers.Contains(this.GetComponent <NetworkIdentity>())) { a.revive_helpers.Add(this.GetComponent <NetworkIdentity>()); } } else { //je li ovaj igrač ubrojan kao reviver ako je izbaci ga if (a.revive_helpers.Contains(this.GetComponent <NetworkIdentity>())) { a.revive_helpers.Remove(this.GetComponent <NetworkIdentity>()); } } }
public void CharacterSetup(string n, int a, Texture2D p, Vector3 v) { profile = new CharProfile(n, a, p); transform.position = v; }