Exemple #1
0
        //update for an indirect attack
        public bool OnIndirectAttackUpdate()
        {
            if (sourceStepTimer > 0)
            {
                sourceStepTimer -= Time.deltaTime;
            }
            else
            {
                source.InvokeAttackPerformedEvent();
                //not an area attack:
                CustomEvents.OnAttackPerformed(source, source.Target, source.GetTargetPosition());

                sources[sourceStep].Launch(gameMgr.EffectPool, source);
                if (launchType == LaunchTypes.inOrder)                                //if the attack is supposed to go through attack objects in order and launch them
                {
                    sourceStep++;                                                     //increment the source step
                }
                if (sourceStep >= sources.Length || launchType == LaunchTypes.random) //if we reached the last attack object or the launch type is set to random
                {
                    sourceStep = 0;                                                   //end of attack
                    source.OnAttackComplete();
                }
                else //move to next attack object
                {
                    sourceStepTimer = sources[sourceStep].GetDelay();
                }

                return(true); //return whenever an attack object is launched
            }

            return(false);
        }