void Awake() { //Check if there is already an instance of BagSystem if (instance == null) { //if not, set it to this. instance = this; } //If instance already exists: else if (instance != this) { //Destroy this, this enforces our singleton pattern so there can only be one instance of BagSystem. Destroy(gameObject); } //Set SoundManager to DontDestroyOnLoad so that it won't be destroyed when reloading our scene. DontDestroyOnLoad(gameObject); }
static bool Prefix(BagSystem __instance, int value, ref ObscuredInt ___m_soul_secret) { if (!Main.enabled) { return(true); } //__instance.UpdateSoul(___m_soul + value); if (!__instance.photonView.isMine) { return(false); } ___m_soul_secret += value; if (___m_soul_secret <= 0) { ___m_soul_secret = 0; } __instance.photonView.RPC("RpcUpdateSoul", PhotonTargets.All, (object)(int)___m_soul_secret); return(false); }
public virtual void RecordComponents() { Bag = GetComponent <BagSystem>(); if (!System.Object.ReferenceEquals(null, Bag)) { Bag.Owner = this; } Shortcut = GetComponent <ShortCutSystem>(); if (!System.Object.ReferenceEquals(null, Shortcut)) { Shortcut.Owner = this; } RoleInfo = GetComponent <RoleInfoSystem>(); if (RoleInfo) { RoleInfo.Owner = this; } }
private void SetBagSys() { bagSys = m_bagSys; }