private IEnumerator OnCast( EditorShip caster, EditorShip[] targets, Skill skill ) { Debugger.Log( "DoSpellSequences()..." ); Transform[] castPoints = FindOutAllAttackPoint( caster.Go.transform, skill.attackPoint ).ToArray(); Transform[] hitPoints = new Transform[castPoints.Length]; for( int i = 0; i < hitPoints.Length; i++ ) { hitPoints[i] = GetHitPointTrans( targets[0] );//random } //1.on sing stage yield return StartCoroutine( PlayEffect( skill.singEffect.effectPath, skill.singEffect.audioPath, skill.singEffect.duration, castPoints ) ); //2.on attack stage yield return StartCoroutine( PlayEffect( skill.attackEffect.effectPath, skill.attackEffect.audioPath, skill.attackEffect.duration, castPoints ) ); //3.on bullet move stage yield return StartCoroutine( OnCastLaser( skill.bulletPath, targets[0], castPoints, hitPoints ) ); //4.on hit stage yield return StartCoroutine( PlayEffect( skill.hitEffect.effectPath, skill.hitEffect.audioPath, skill.hitEffect.duration, hitPoints ) ); }
private IEnumerator PreloadAllResources( Skill skill ) { yield return StartCoroutine( PreloadResources( skill.attackEffect.effectPath ) ); yield return StartCoroutine( PreloadResources( skill.hitEffect.effectPath ) ); yield return StartCoroutine( PreloadResources( skill.singEffect.effectPath ) ); yield return StartCoroutine( PreloadResources( skill.bulletPath ) ); yield return StartCoroutine( PreloadResources( skill.attackEffect.audioPath ) ); yield return StartCoroutine( PreloadResources( skill.hitEffect.audioPath ) ); yield return StartCoroutine( PreloadResources( skill.singEffect.audioPath ) ); }
private IEnumerator CastSkill( EditorShip caster, Skill skill, CharactersGroup group, int targetIndex ) { Debugger.Log( "CastSpell()..." ); yield return StartCoroutine( PreloadAllResources( skill ) ); //just test the first ship of the other side EditorShip[] targetShips = new EditorShip[] { group.GetShip( targetIndex ) }; yield return StartCoroutine( OnCast( caster, targetShips, skill ) ); }