Inheritance: MonoBehaviour
 public virtual void unsetSelectedObject(Activateable obj)
 {
     if(selectedObject == obj)
     {
         selectedObject = null;
     }
 }
 public virtual void setSelectedObject(Activateable obj, Vector3 offset)
 {
     // Can't select currently held weapon
     if(obj != weaponHandler.weapon && activateableTypes.Exists(t => t == obj.GetType().BaseType))
     {
         selectedObject = obj;
     }
 }
Example #3
0
        protected async Task OnClickHandler(MouseEventArgs ev)
        {
            await OnClick.InvokeAsync(ev);

            if (Command?.CanExecute(CommandParameter) ?? false)
            {
                Command.Execute(CommandParameter);
            }
            Activateable?.Activate(this, ev);
        }
 public override void setSelectedObject(Activateable obj, Vector3 offset)
 {
     // Can't select currently held weapon
     if(obj.GetType() != typeof(Rifle) && obj.GetType() != typeof(Weapon) && activateableTypes.Exists(t => t == obj.GetType().BaseType || t == obj.GetType()))
     {
         selectedObject = obj;
         Destroy(activationTexture);
         Vector3 distance = gameObject.transform.position - obj.transform.position;
         distance.y = 0.0f;
         Quaternion rotation = Quaternion.Euler(90.0f, Quaternion.LookRotation(distance).eulerAngles.y, 0.0f);
         activationTexture = (GameObject)Instantiate(activationPrefab, obj.rigidbody.transform.position + Vector3.up + offset, rotation);
     }
 }
 public void SetSelection(Activateable obj)
 {
     _activation.selectedObject = obj;
 }
 void EarlyUpdate()
 {
     selectedObject = null;
 }
 public void Init(Activateable activateable)
 {
     Actor = activateable;
 }
 public override void unsetSelectedObject(Activateable obj)
 {
     Destroy(activationTexture);
     base.unsetSelectedObject(obj);
 }
 // Use this for initialization
 void Start()
 {
     aTarget = target.GetComponent(typeof(Activateable)) as Activateable;
 }