public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
 {
     if (beBlock.BeBlockGroup.isActive)
     {
         BeController.PlayNextInside(beBlock);
     }
 }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        targetObject.transform.position = new Vector3(beBlock.BeInputs.numberValues[0], beBlock.BeInputs.numberValues[1],
                                                      beBlock.BeInputs.numberValues[2]);

        BeController.PlayNextOutside(beBlock);
    }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        Vector3 axis;

        switch (beBlock.BeInputs.stringValues[0])
        {
        case "X axis":
            axis = Vector3.right;
            break;

        case "Y axis":
            axis = Vector3.up;
            break;

        case "Z axis":
            axis = Vector3.forward;
            break;

        default:
            axis = Vector3.up;
            break;
        }

        targetObject.transform.Rotate(axis, beBlock.BeInputs.numberValues[1]);

        BeController.PlayNextOutside(beBlock);
    }
예제 #4
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        soundToPlay = BeController.GetSound(beBlock.BeInputs.stringValues[0]);
        targetObject.beAudioSource.clip = soundToPlay;
        targetObject.beAudioSource.Play();

        BeController.PlayNextOutside(beBlock);
    }
예제 #5
0
 public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
 {
     if (BEOperation(targetObject, beBlock) == "1")
     {
         BeController.PlayNextInside(beBlock);
     }
     else
     {
         BeController.PlayNextOutside(beBlock);
     }
 }
예제 #6
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (targetObject.GetComponent <Rigidbody2D>())
        {
            targetObject.GetComponent <Rigidbody2D>().AddForce(targetObject.transform.right * beBlock.BeInputs.numberValues[0]);
        }
        else if (targetObject.GetComponent <Rigidbody>())
        {
            targetObject.GetComponent <Rigidbody>().AddForce(targetObject.transform.forward * beBlock.BeInputs.numberValues[0]);
        }

        BeController.PlayNextOutside(beBlock);
    }
예제 #7
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (targetObject.GetComponent <Collider2D>())
        {
            targetObject.transform.position += targetObject.transform.right * beBlock.BeInputs.numberValues[0];
        }
        else if (targetObject.GetComponent <Collider>())
        {
            targetObject.transform.position += targetObject.transform.forward * beBlock.BeInputs.numberValues[0];
        }

        BeController.PlayNextOutside(beBlock);
    }
예제 #8
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (beBlock.BeInputs.stringValues[0] == "Random")
        {
            targetObject.GetComponent <Renderer>().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
        }
        else
        {
            mat = BeController.GetColor(beBlock.BeInputs.stringValues[0]);
            targetObject.GetComponent <Renderer>().material.color = mat.color;
        }

        BeController.PlayNextOutside(beBlock);
    }
예제 #9
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (beBlock.beBlockFirstPlay)
        {
            counterForRepetitions    = (int)beBlock.BeInputs.numberValues[1];
            beBlock.beBlockFirstPlay = false;
        }

        // [0] first input (dropdown)
        // options: up-right, up-left, down-right, down-left, right-up, right-down, left-up, left-down
        string option = beBlock.BeInputs.stringValues[0];

        string[] options = option.Split('-');

        //movements
        Vector3 firstMovement  = GetDirection(options[0]);
        Vector3 secondMovement = GetDirection(options[1]);

        Vector3[] movements = new[] { firstMovement, firstMovement, secondMovement };

        if (counterForMovement == 0)
        {
            startPos = targetObject.transform.position;
        }

        if (counterForMovement <= movementDuration)
        {
            counterForMovement += Time.deltaTime;
            targetObject.transform.position = Vector3.Lerp(startPos, startPos + movements[moveSelection], counterForMovement / movementDuration);
        }
        else
        {
            moveSelection++;
            counterForMovement = 0;
        }

        if (moveSelection == 3)
        {
            moveSelection      = 0;
            counterForMovement = 0;
            counterForRepetitions--;

            if (counterForRepetitions <= 0)
            {
                beBlock.beBlockFirstPlay = true;
                BeController.PlayNextOutside(beBlock);
            }
        }
    }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        try
        {
            float newValue = float.Parse(BeController.GetVariable(beBlock.BeInputs.stringValues[0]), CultureInfo.InvariantCulture)
                             + beBlock.BeInputs.numberValues[1];
            BeController.SetVariable(beBlock.BeInputs.stringValues[0], newValue.ToString(CultureInfo.InvariantCulture));
        }
        catch
        {
            string newValue = BeController.GetVariable(beBlock.BeInputs.stringValues[0]);
            BeController.SetVariable(beBlock.BeInputs.stringValues[0], newValue.ToString(CultureInfo.InvariantCulture));
        }

        BeController.PlayNextOutside(beBlock);
    }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        Vector3 axis = Vector3.up;

        if (targetObject.GetComponent <Collider2D>())
        {
            axis = Vector3.forward;
        }
        else if (targetObject.GetComponent <Collider>())
        {
            axis = Vector3.up;
        }

        targetObject.transform.Rotate(axis, 90);

        BeController.PlayNextOutside(beBlock);
    }
예제 #12
0
 public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
 {
     if (beBlock.BeInputs.stringValues[0] == "1")
     {
         BeController.PlayNextOutside(beBlock);
     }
     else
     {
         if (beBlock.beChildBlocksList.Count > 0)
         {
             BeController.PlayNextInside(beBlock);
         }
         else
         {
             BeController.PlayNextOutside(beBlock);
         }
     }
 }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        switch (beBlock.BeInputs.stringValues[0])
        {
        case "ArrowUp":
            beJoyButton = BeController.beJoystick.arrowUpButton;
            break;

        case "ArrowLeft":
            beJoyButton = BeController.beJoystick.arrowLeftButton;
            break;

        case "ArrowDown":
            beJoyButton = BeController.beJoystick.arrowDownButton;
            break;

        case "ArrowRight":
            beJoyButton = BeController.beJoystick.arrowRightButton;
            break;

        case "ButtonA":
            beJoyButton = BeController.beJoystick.buttonA;
            break;

        case "ButtonB":
            beJoyButton = BeController.beJoystick.buttonB;
            break;

        default:
            beJoyButton = null;
            break;
        }

        if (beJoyButton.isPressed)
        {
            beBlock.BeBlockGroup.isActive = true;
            BeController.PlayNextInside(beBlock);
        }
        else
        {
            beBlock.BeBlockGroup.isActive = false;
            BeController.StopGroup(beBlock.BeBlockGroup);
        }
    }
예제 #14
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (beBlock.beBlockFirstPlay)
        {
            counter = beBlock.BeInputs.numberValues[0];

            beBlock.beBlockFirstPlay = false;
        }
        if (counter > 0)
        {
            counter -= Time.deltaTime;
        }
        else
        {
            beBlock.beBlockFirstPlay = true;
            counter = 0;
            BeController.PlayNextOutside(beBlock);
        }
    }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (beBlock.beBlockFirstPlay)
        {
            counterForRepetitions = (int)beBlock.BeInputs.numberValues[0];
            startPos = targetObject.transform.position;
            beBlock.beBlockFirstPlay = false;
        }

        if (counterForMovement == 0)
        {
            startPos = targetObject.transform.position;
        }

        if (counterForMovement <= movementDuration)
        {
            counterForMovement += Time.deltaTime;
            if (targetObject.GetComponent <Collider2D>())
            {
                direction = targetObject.transform.right;
            }
            else if (targetObject.GetComponent <Collider>())
            {
                direction = targetObject.transform.forward;
            }
            targetObject.transform.position = Vector3.Lerp(startPos, startPos + direction, counterForMovement / movementDuration);
        }
        else
        {
            counterForMovement = 0;
            counterForRepetitions--;

            if (counterForRepetitions <= 0)
            {
                beBlock.beBlockFirstPlay = true;
                BeController.PlayNextOutside(beBlock);
            }
        }
    }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        try
        {
            key = (KeyCode)System.Enum.Parse(typeof(KeyCode), beBlock.BeInputs.stringValues[0]);
        }
        catch (Exception e)
        {
            Debug.Log("probably still initializing");
            Debug.Log(e);
        }

        if (Input.GetKey(key))
        {
            beBlock.BeBlockGroup.isActive = true;
            BeController.PlayNextInside(beBlock);
        }
        else if (!Input.GetKey(key))
        {
            beBlock.BeBlockGroup.isActive = false;
            BeController.StopGroup(beBlock.BeBlockGroup);
        }
    }
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        Vector3 axis = Vector3.up;

        switch (beBlock.BeInputs.stringValues[0])
        {
        case "Left":
            if (targetObject.GetComponent <Collider2D>())
            {
                axis = Vector3.forward;
            }
            else if (targetObject.GetComponent <Collider>())
            {
                axis = Vector3.up;
            }
            targetObject.transform.Rotate(axis, -90);
            break;

        case "Right":
            if (targetObject.GetComponent <Collider2D>())
            {
                axis = Vector3.forward;
            }
            else if (targetObject.GetComponent <Collider>())
            {
                axis = Vector3.up;
            }
            targetObject.transform.Rotate(axis, 90);
            break;

        default:
            break;
        }

        BeController.PlayNextOutside(beBlock);
    }
예제 #18
0
 public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
 {
     BeController.PlayNextInside(beBlock);
 }
예제 #19
0
    public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
    {
        if (targetObject.GetComponent <Collider2D>())
        {
            switch (beBlock.BeInputs.stringValues[0])
            {
            case "Forward":
                targetObject.transform.eulerAngles = new Vector3(0, 0, 0);
                break;

            case "Back":
                targetObject.transform.eulerAngles = new Vector3(0, 0, 180);
                break;

            case "Up":
                targetObject.transform.eulerAngles = new Vector3(0, 0, 90);
                break;

            case "Down":
                targetObject.transform.eulerAngles = new Vector3(0, 0, -90);
                break;

            case "Left":
                targetObject.transform.eulerAngles = new Vector3(0, 0, 180);
                break;

            case "Right":
                targetObject.transform.eulerAngles = new Vector3(0, 0, 0);
                break;

            default:
                targetObject.transform.eulerAngles = new Vector3(0, 0, 90);
                break;
            }
        }
        else if (targetObject.GetComponent <Collider>())
        {
            switch (beBlock.BeInputs.stringValues[0])
            {
            case "Forward":
                targetObject.transform.eulerAngles = new Vector3(0, 0, 0);
                break;

            case "Back":
                targetObject.transform.eulerAngles = new Vector3(0, 180, 0);
                break;

            case "Up":
                targetObject.transform.eulerAngles = new Vector3(-90, 0, 0);
                break;

            case "Down":
                targetObject.transform.eulerAngles = new Vector3(90, 0, 0);
                break;

            case "Left":
                targetObject.transform.eulerAngles = new Vector3(0, -90, 0);
                break;

            case "Right":
                targetObject.transform.eulerAngles = new Vector3(0, 90, 0);
                break;

            default:
                targetObject.transform.eulerAngles = new Vector3(0, 0, 0);
                break;
            }
        }

        BeController.PlayNextOutside(beBlock);
    }
    public override string BEOperation(BETargetObject targetObject, BEBlock beBlock)
    {
        string value = BeController.GetVariable(beBlock.BeInputs.stringValues[0]);

        return(value);
    }
예제 #21
0
 public override void BEFunction(BETargetObject targetObject, BEBlock beBlock)
 {
     BeController.SetVariable(beBlock.BeInputs.stringValues[0], beBlock.BeInputs.stringValues[1]);
     BeController.PlayNextOutside(beBlock);
 }