Skip to content
Snippets Groups Projects
Select Git revision
  • 13036fdafae6f380eefea096fd408dbf8c454ae7
  • main default
  • master
  • tempAndrToMaster
4 results

TreeWorld.unity

Blame
  • Remover.cs 870 B
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using static CommunicationEvents;
    
    public class Remover : Gadget
    {
        public WorldCursor Cursor;
    
        void Awake()
        {
            if (FactManager == null)
                FactManager = GameObject.FindObjectOfType<FactManager>();
    
            if (this.Cursor == null)
                this.Cursor = GameObject.FindObjectOfType<WorldCursor>();
    
            this.UiName = "Remove Mode";
            CommunicationEvents.TriggerEvent.AddListener(OnHit);
        }
    
        void OnEnable()
        {
            this.Cursor.setLayerMask(~this.ignoreLayerMask.value);
        }
    
        public override void OnHit(RaycastHit hit)
        {
    
            if (!this.isActiveAndEnabled)
                return;
    
            // TODO: ask/warn user to cascade
            var hid = hit.transform.GetComponent<FactObject>().URI;
            Facts.Remove(hid);
        }
      
    }