🧨Reactions
Overview
How to use them
Reactions Component


Reaction Scriptable Var


Scripting

Creating a new Reaction Type
Last updated





Last updated
[SerializeReference,SubclassSelector]
public Reaction reaction;reaction?.React(component); //Add a Target to the reaction, [Component]
//OR
reaction?.React(gameObject); //Add a Target to the reaction, [GameObject]using MalbersAnimations;
using MalbersAnimations.Reactions;
using System;
using UnityEngine;
[System.Serializable] //Needs to be Serializable!!!!
[AddTypeMenu("My Reaction/Enable Collider")]
public class EnableColliderReaction : Reaction
{
//set the Type of component this Reaction Needs
public override Type ReactionType => typeof(Collider);
public bool enable;
protected override bool _TryReact(Component reactor)
{
Collider collider = reactor as Collider; //Cast the reactor as collider type.
collider.enabled = enable; //set the enable paramater
return true; //Reaction succesful!!
}
}