Exemplo n.º 1
0
        void Awake()
        {
            PetManager.TrollIns = this.gameObject;
            tame = this.GetComponent <Tameable>();
            tame.m_commandable = true;
            tame.m_fedDuration = 300;
            tame.Tame();
            Traverse.Create(tame).Method("ResetFeedingTimer").GetValue();
            Character character = this.GetComponent <Character>();

            character.m_onDeath = (Action)Delegate.Combine(new Action(this.OnDestroyed), character.m_onDeath);
        }
Exemplo n.º 2
0
 // Token: 0x0600028E RID: 654 RVA: 0x00014B38 File Offset: 0x00012D38
 public static void TameAllInArea(Vector3 point, float radius)
 {
     foreach (Character character in Character.GetAllCharacters())
     {
         if (!character.IsPlayer())
         {
             Tameable component = character.GetComponent <Tameable>();
             if (component)
             {
                 component.Tame();
             }
         }
     }
 }
Exemplo n.º 3
0
        private void Awake()
        {
            PetManager.WolfIns = this.gameObject;
            container          = this.GetComponent <Container>();

            Character character = this.GetComponent <Character>();

            character.m_onDeath = (Action)Delegate.Combine(new Action(this.OnDeath), character.m_onDeath);

            tame = this.GetComponent <Tameable>();
            tame.Tame();
            tame.m_fedDuration = 1800;
            Traverse.Create(tame).Method("ResetFeedingTimer").GetValue();

            m_hum = this.GetComponent <Humanoid>();
        }
Exemplo n.º 4
0
 private new void GrowUpdate()
 {
     if (!this.m_nview.IsValid() || !this.m_nview.IsOwner())
     {
         return;
     }
     growStats = Mathf.FloorToInt((float)(GetTimeSinceSpawned().TotalSeconds / (double)this.m_growTime * 100));
     if (GetTimeSinceSpawned().TotalSeconds > (double)this.m_growTime)
     {
         Tameable component2 = UnityEngine.Object.Instantiate <GameObject>(this.m_grownPrefab, base.transform.position, base.transform.rotation).GetComponent <Tameable>();
         if (component2)
         {
             component2.Tame();
         }
         this.m_nview.Destroy();
     }
 }
Exemplo n.º 5
0
        public static void Spawn(string type, int level = 1, float offset = 100, bool tamed = false, string name = null)
        {
            try
            {
                var prefab = ZNetScene.instance.GetPrefab(type);

                if (!prefab)
                {
                    Log.Error("Missing prefab " + type);
                    return;
                }

                Log.Info("Spawning prefab " + type);

                if (!Player.m_localPlayer)
                {
                    Log.Error("Missing local player");
                    return;
                }

                Vector3 b        = UnityEngine.Random.insideUnitSphere * offset;
                var     position = Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 2f + Vector3.up + b;

                Log.Info("Spawning position " + position.ToString());

                var instance = UnityEngine.Object.Instantiate(prefab, position, Quaternion.identity);

                //var renderer = instance.GetComponentInChildren<SkinnedMeshRenderer>();
                //renderer.material = ZNetScene.instance.GetPrefab("Blob").GetComponentInChildren<SkinnedMeshRenderer>().material;

                if (!instance)
                {
                    Log.Error("Missing prefab instance");
                    return;
                }

                var character = instance.GetComponent <Character>();

                if (character == null)
                {
                    return;
                }

                ZNetView znview    = character.GetComponent <ZNetView>();
                Tameable component = SetTameable(znview, instance);

                if (name != null)
                {
                    SetName(znview, character, name, tamed);
                }

                if (tamed && component != null)
                {
                    component.Tame();

                    var humanoid = instance.GetComponent <Humanoid>();
                    humanoid.m_faction = Character.Faction.Players;

                    CharacterAwakePatch.tamedCharacters.Add(character);
                    znview.GetZDO().Set($"{Plugin.GUID}-tamed", true);
                }

                if (level > 0)
                {
                    character.SetLevel(level);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }