from helper import * 
import host
import math

last_generate = 0
speed = 0.0003 # per second
offset = 0
def generate(stat, elapsed):
    s = Stat(stat)
    global offset
    offset = offset + 0.01
    
    global last_generate
    if (s.time.live_time - last_generate) > 200:
        result = []
        last_generate = s.time.live_time
        
        s.time.ttl = -1
        s.time.live_time = 0
        
        s.scale.x = 0.35
        s.scale.y = 0.35
        s.scale.z = 0.6

        fans = 5
        for i in range(0, fans):
            a = 3.14159265 * 2 * i / fans + offset
            s.data = StraightAnimatorStat((AnimatorType.Straight, math.cos(a) * speed, math.sin(a) * speed, 0)) 
            result.append(host.generate(s.toTuple(), "straight", 'empty', 'empty', 'test'))
        
        return result
    return []
