public void HoldTool(Type toolType) { if (UserGameObject != null) { _currentTool.OnToolDropped(this); ToolCache.StowTool(_currentTool); _currentTool = ToolCache.GetOrCreateTool(toolType); _currentTool.OnToolHeld(this); } }
public void HoldTool(Type toolType) { if (UserGameObject != null) { _currentTool.IsHeld = false; ToolCache.StowTool(_currentTool); _currentTool = ToolCache.GetOrCreateTool(toolType); _currentTool.IsHeld = true; } }
public void DropTool() { // We only drop a tool is it isn't the default target tool. if (UserGameObject != null && _currentTool.GetType() != typeof(TargetTool)) { _currentTool.OnToolDropped(this); ToolCache.StowTool(_currentTool); _currentTool = ToolCache.GetOrCreateTool <TargetTool>(); _currentTool.OnToolHeld(this); } }
public override void _Ready() { // Only target layers 0 (Default), 5 (UI), and 10 (Hologram). // You still want to hit all layers, but only interact with these. uint layerMask = (1 << 0) | (1 << 5) | (1 << 10); rayCast = GetNode <RayCast>("RayCast"); rayCast.CastTo = new Vector3(0, 0, -100); rayCast.CollisionMask = layerMask; _currentTool = ToolCache.GetOrCreateTool <TargetTool>(); _currentTool.OnToolHeld(this); }
private void Start() { _currentTool = ToolCache.GetOrCreateTool <TargetTool>(); _currentTool.OnToolHeld(this); }
private void Start() { _currentTool = ToolCache.GetOrCreateTool <TargetTool>(); _currentTool.IsHeld = true; }