private static ITweenSequence GetSequence(SequenceType sequenceType) { if (_sequencesInProgress == null) { _sequencesInProgress = new HashSet <ITweenSequence>(); } var sequence = JobPool.CanSpawnSequence() ? JobPool.SpawnSequence(sequenceType) : JobFactory.CreateSequence(Instance, sequenceType); _sequencesInProgress.Add(sequence); sequence.OnComplete(() => { SequenceComplete(sequence); }); sequence.OnKill(() => { SequenceComplete(sequence); }); return(sequence); }
private static ITweenJob GetTweenJob <T>() { if (_jobsInProgress == null) { _jobsInProgress = new HashSet <ITweenJob>(); } var job = JobPool.CanSpawnJob <T>() ? JobPool.SpawnJob <T>() : JobFactory.CreateJob <T>(); if (job == null) { throw new Exception($"unsupported type {typeof(T)} !!"); } _jobsInProgress.Add(job); job.Reset(); job.OnComplete(() => { JobComplete(job); }); job.OnKill(() => { JobComplete(job); }); return(job); }