Skip to content
Snippets Groups Projects
Select Git revision
  • f818ac70efcbdb7726fe2ef84d50674667d302a9
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

Remover.cs

Blame
  • MaZiFAU's avatar
    Marco Zimmer authored
    +Added Scenes: MainMenue, LoadingScreen +Stage: Save-Load fuctionality +Sorted Prefabs and Scripts Folder
    f818ac70
    History
    Remover.cs 893 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;
            GlobalStatic.stage.factState.Remove(hid);
        }
      
    }