// ^ For those that don't need to do the input sequence to make this ability do its // thing for them. // Methods public override void Apply(MonoBehaviour client) { if (!isActive) { Debug.Log(name + " is inactive"); return; } //Debug.Log("Executing " + name + " ability."); // Set up the sequence checker responding to the client's inputs, if this ability has // any. bool thereAreInputs = inputSequence != null && inputSequence.Length > 0; bool newJob = !sequenceCheckers.ContainsKey(client); bool notInputBypasser = !inputBypassers.Contains(client); if (thereAreInputs && newJob && notInputBypasser) { PlayerInputSequenceChecker seqChecker = SetupSequenceChecker(client); sequenceCheckers[client] = seqChecker; seqChecker.isChecking = true; } else { ApplyEffects(client); } }
protected virtual PlayerInputSequenceChecker SetupSequenceChecker(MonoBehaviour client) { PlayerInputSequenceChecker seqChecker = null; if (inputSequence != null) { // Bind the sequence to a checker, and execute the effect when it reports // success on inputting that sequence seqChecker = new PlayerInputSequenceChecker(client, inputSequence); //seqChecker.Init(user, inputSequence); UnityAction logSuccess = () => { Debug.Log(this.name + " executed successfully"); }; //seqChecker.Success.AddListener(logSuccess); //seqChecker.Success.AddListener(applyByCoroutine); seqChecker.Success.AddListener(() => ApplyEffects(client)); } return(seqChecker); }