예제 #1
0
 private void SlowUpdate()
 {
     if (destruct != null && auto_destroy && !destruct.IsDead() && !building_mode)
     {
         if (!CheckValidFloorBuilt() || !CheckIfFlatGround())
         {
             destruct.Kill();
         }
     }
 }
 public void Kill()
 {
     if (destruct != null)
     {
         destruct.Kill();
     }
     else
     {
         selectable.Destroy();
     }
 }
예제 #3
0
        public void Harvest(PlayerCharacter character)
        {
            if (fruit != null && has_fruit && character.Inventory.CanTakeItem(fruit, 1))
            {
                GameObject source = fruit_model != null ? fruit_model.gameObject : gameObject;
                character.Inventory.GainItem(fruit, 1, source.transform.position);

                RemoveFruit();

                if (death_on_harvest && destruct != null)
                {
                    destruct.Kill();
                }

                TheAudio.Get().PlaySFX("plant", gather_audio);

                if (gather_fx != null)
                {
                    Instantiate(gather_fx, transform.position, Quaternion.identity);
                }
            }
        }
예제 #4
0
 public void Kill()
 {
     if (destruct != null)
     {
         destruct.Kill();
     }
     else if (selectable != null)
     {
         selectable.Destroy();
     }
     else
     {
         Destroy(gameObject);
     }
 }
        //Destroy the object
        public void Destroy()
        {
            Destructible destruct = GetComponent <Destructible>();
            Item         item     = GetComponent <Item>();

            if (destruct != null)
            {
                destruct.Kill(); //Kill destruct to spawn loot and save
            }
            else if (item != null)
            {
                item.DestroyItem(); //Or destroy item if its an item
            }
            else if (cselect != null)
            {
                cselect.Destroy(); //Or destroy selectable otherwise
            }
        }
 public void Dig()
 {
     destruct.Kill();
 }