Example #1
0
    public void SetupIOTypes(BaseShapeType inputType, BaseShapeType outputType)
    {
        InputType  = inputType;
        OutputType = outputType;

        InputHolder.sprite = ShapesRepository.Instance.GetBaseSprite(inputType);
        GetComponent <SpriteRenderer>().sprite = ShapesRepository.Instance.GetBaseSprite(outputType);
    }
Example #2
0
    public Sprite GetBaseSprite(BaseShapeType type)
    {
        switch (type)
        {
        case BaseShapeType.Square:
            return(SquareBaseSprite);

        case BaseShapeType.Circle:
            return(CircleBaseSprite);

        case BaseShapeType.Triangle:
            return(TriangleBaseSprite);
        }
        return(null);
    }
Example #3
0
    private Shape CreateRandomTransistorShape()
    {
        TransistorShape shape = Instantiate(CommonTransistorShape, Vector3.zero, Quaternion.identity);

        BaseShapeType[] types =
        {
            BaseShapeType.Square,
            BaseShapeType.Circle,
            BaseShapeType.Triangle
        };

        BaseShapeType inputType  = types[Random.Range(0, types.Length)];
        BaseShapeType outputType = types[Random.Range(0, types.Length)];

        shape.SetupIOTypes(inputType, outputType);

        return(shape);
    }