Ejemplo n.º 1
0
    // Token: 0x06000E57 RID: 3671 RVA: 0x00066910 File Offset: 0x00064B10
    private void Grow()
    {
        if (this.m_status != Plant.Status.Healthy)
        {
            if (this.m_destroyIfCantGrow)
            {
                this.Destroy();
            }
            return;
        }
        GameObject original   = this.m_grownPrefabs[UnityEngine.Random.Range(0, this.m_grownPrefabs.Length)];
        Quaternion quaternion = Quaternion.Euler(0f, UnityEngine.Random.Range(0f, 360f), 0f);
        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original, base.transform.position, quaternion);
        ZNetView   component  = gameObject.GetComponent <ZNetView>();
        float      num        = UnityEngine.Random.Range(this.m_minScale, this.m_maxScale);

        component.SetLocalScale(new Vector3(num, num, num));
        TreeBase component2 = gameObject.GetComponent <TreeBase>();

        if (component2)
        {
            component2.Grow();
        }
        this.m_nview.Destroy();
        this.m_growEffect.Create(base.transform.position, quaternion, null, num);
    }
Ejemplo n.º 2
0
 // Token: 0x06000CDF RID: 3295 RVA: 0x0005C098 File Offset: 0x0005A298
 public void Destroy()
 {
     this.CreateDestructionEffects();
     if (this.m_destroyNoise > 0f)
     {
         Player closestPlayer = Player.GetClosestPlayer(base.transform.position, 10f);
         if (closestPlayer)
         {
             closestPlayer.AddNoise(this.m_destroyNoise);
         }
     }
     if (this.m_spawnWhenDestroyed)
     {
         ZNetView component = UnityEngine.Object.Instantiate <GameObject>(this.m_spawnWhenDestroyed, base.transform.position, base.transform.rotation).GetComponent <ZNetView>();
         component.SetLocalScale(base.transform.localScale);
         component.GetZDO().SetPGWVersion(this.m_nview.GetZDO().GetPGWVersion());
     }
     if (this.m_onDestroyed != null)
     {
         this.m_onDestroyed();
     }
     ZNetScene.instance.Destroy(base.gameObject);
     this.m_destroyed = true;
 }