コード例 #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.attachedRigidbody == ledArea)
     {
         serialHandler.SetLed(true);
     }
 }
コード例 #2
0
    private IEnumerator InitLeds()
    {
        while (!serialHandler.IsSerialReady)
        {
            yield return(null);
        }

        yield return(new WaitForSeconds(1f));

        serialHandler.SetLed(1, creatureCountToPurcentage(CreatureFactory.Instance.CreatureCountTable[Led1specie]));
        serialHandler.SetLed(2, creatureCountToPurcentage(CreatureFactory.Instance.CreatureCountTable[Led2specie]));
        serialHandler.SetLed(3, creatureCountToPurcentage(CreatureFactory.Instance.CreatureCountTable[Led3specie]));
    }
コード例 #3
0
    private IEnumerator UpdateLeds()
    {
        while (true)
        {
            yield return(new WaitForSeconds(updateFreq));

            if (Observed != null)
            {
                serialHandler.SetLed(1, Observed.Gauges.Hunger.Rate);
                serialHandler.SetLed(2, Observed.Gauges.Reproduction.Rate);
                serialHandler.SetLed(3, Observed.Gauges.Life.Rate);
            }
            else
            {
                serialHandler.SetLed(1, 0);
                serialHandler.SetLed(2, 0);
                serialHandler.SetLed(3, 0);
            }
        }
    }
コード例 #4
0
    private IEnumerator CreatureBirthLed()
    {
        serialHandler.SetLed(CreatureBirthLED, 100);
        yield return(new WaitForSeconds(0.2f));

        serialHandler.SetLed(CreatureBirthLED, 0);
        yield return(new WaitForSeconds(0.2f));

        serialHandler.SetLed(CreatureBirthLED, 100);
        yield return(new WaitForSeconds(0.2f));

        serialHandler.SetLed(CreatureBirthLED, 0);
        yield return(null);
    }