private IEnumerator OnCast( EditorShip caster, EditorShip[] targets, Part part ) { Debugger.Log( "DoSpellSequences()..." ); Transform[] castPoints = FindOutAllAttackPoint( caster.Go.transform, part.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( part.singEffect.effectPath, part.singEffect.audioPath, part.singEffect.duration, castPoints ) ); //2.on attack stage yield return StartCoroutine( PlayEffect( part.attackEffect.effectPath, part.attackEffect.audioPath, part.attackEffect.duration, castPoints ) ); //3.on bullet move stage yield return StartCoroutine( OnBulletMove( part.bulletPath, targets[0], castPoints, hitPoints ) ); //4.on hit stage yield return StartCoroutine( PlayEffect( part.hitEffect.effectPath, part.hitEffect.audioPath, part.hitEffect.duration, hitPoints ) ); }
private IEnumerator PreloadAllResources( Part part ) { yield return StartCoroutine( PreloadResources( part.attackEffect.effectPath ) ); yield return StartCoroutine( PreloadResources( part.hitEffect.effectPath ) ); yield return StartCoroutine( PreloadResources( part.singEffect.effectPath ) ); yield return StartCoroutine( PreloadResources( part.bulletPath ) ); yield return StartCoroutine( PreloadResources( part.attackEffect.audioPath ) ); yield return StartCoroutine( PreloadResources( part.hitEffect.audioPath ) ); yield return StartCoroutine( PreloadResources( part.singEffect.audioPath ) ); }
private IEnumerator CastSpell( EditorShip caster, Part part, CharactersGroup group, int targetIndex ) { Debugger.Log( "CastSpell()..." ); yield return StartCoroutine( PreloadAllResources( part ) ); //just test the first ship of the other side EditorShip[] targetShips = new EditorShip[] { group.GetShip( targetIndex ) }; yield return StartCoroutine( OnCast( caster, targetShips, part ) ); }