Exemple #1
0
        public void Initialize(PatternDefinition def)
        {
            definition = def;
            Debug.Log("Starting Pattern: " + definition.name);
            runParams = new RuntimeParameters()
            {
                rotationSpeed = def.rotationSpeed
            };

            // Spawn Points
            GameObject pointsParentGo = new GameObject("AttackPoints Root");

            runParams.pointsParent = pointsParentGo.transform;
            runParams.pointsParent.SetParent(transform);
            runParams.attackPoints = definition.CreateSpawnPoints(runParams.pointsParent);

            // Sequence
            procManager     = new ProcessManager();
            sequenceProcess = new SequenceProcess(definition.sequence, runParams, definition.finishedDelay);
            sequenceProcess.TerminateCallback += SequenceFinished;
            procManager.LaunchProcess(sequenceProcess);

            // Simultaneous Patterns
            foreach (PatternDefinition defSimult in definition.simultaneous)
            {
                defSimult.Attach(gameObject).suppressNext = true;
            }
        }
Exemple #2
0
 private void SequenceFinished()
 {
     Debug.Log("Finished Pattern: " + definition.name);
     if (!suppressNext)
     {
         PatternDefinition nextDef = definition.GetRandomNext();
         Pattern           nextPat = null;
         if (nextDef != null)
         {
             nextPat = nextDef.Attach(gameObject);
         }
         OnPatternEnded?.Invoke(nextPat);
     }
     Destroy(this);
     Destroy(runParams.pointsParent.gameObject);
 }