Exemple #1
0
    public void Power()
    {
        if (isStartPowered != startBaseBlock.isPowered)
        {
            if (startBaseBlock.isPowered)
            {
                endBaseBlock.powerOn();
                movingPlatform.GetComponent <movingPlatform>().isPowered = true;
            }
            else
            {
                endBaseBlock.powerOff();
                movingPlatform.GetComponent <movingPlatform>().isPowered = false;
            }
        }

        if (isEndPowered != endBaseBlock.isPowered)
        {
            if (endBaseBlock.isPowered)
            {
                startBaseBlock.powerOn();
                movingPlatform.GetComponent <movingPlatform>().isPowered = true;
            }
            else
            {
                startBaseBlock.powerOff();
                movingPlatform.GetComponent <movingPlatform>().isPowered = false;
            }
        }

        isStartPowered = startBaseBlock.isPowered;
        isEndPowered   = endBaseBlock.isPowered;
    }