Exemplo n.º 1
0
    public override SensorComponent MakeComponent(GameObject gameObject)
    {
        PulseComponent pulse = gameObject.AddComponent <PulseComponent>();

        pulse.offTime = offTime;
        pulse.onTime  = onTime;
        pulse.startOn = startOn;
        return(pulse);
    }
Exemplo n.º 2
0
 void Awake()
 {
     // _button = GetComponent<Button>();
     // _defaultScale = _button.transform.localScale;
     _pulser = GetComponent <PulseComponent>();
     if (_pulser != null)
     {
         _pulser.enabled = false;
     }
 }
Exemplo n.º 3
0
 public override void Update(float dt)
 {
     foreach (Entity pulseEntity in _pulseEntities)
     {
         PulseComponent  pulseComp  = pulseEntity.GetComponent <PulseComponent>();
         SpriteComponent spriteComp = pulseEntity.GetComponent <SpriteComponent>();
         pulseComp.Elapsed += dt;
         float beta = 0.5f * (float)Math.Cos(2 * MathHelper.Pi / pulseComp.Period * pulseComp.Elapsed) + 0.5f;
         spriteComp.Alpha = MathHelper.Lerp(pulseComp.AlphaMin, pulseComp.AlphaMax, beta);
     }
 }