Пример #1
0
    private void ExecuteCommandLine(string text)
    {
        SuperVector superVector = SuperVector.Create(text);

        if (superVector != null)
        {
            CreateOrUpdateSuperVector(superVector);
            return;
        }

        SetColor setColor = SetColor.Create(text);

        if (setColor != null)
        {
            ChangeVectorColor(setColor.vectorName, setColor.hexCode);
            return;
        }

        SetNamedColor setNamedColor = SetNamedColor.Create(text);

        if (setNamedColor != null)
        {
            string hexCode;
            if (colorLookups.ContainsKey(setNamedColor.colorName))
            {
                hexCode = colorLookups[setNamedColor.colorName];
                ChangeVectorColor(setNamedColor.vectorName, hexCode);
            }
            else
            {
                Debug.LogError($"\"{setNamedColor.colorName}\" needs to be defined first!!!");
            }
            return;
        }

        DefineColor defineColor = DefineColor.Create(text);

        if (defineColor != null)
        {
            DefineColorName(defineColor.colorName, defineColor.hexCode);
            return;
        }

        MoveVector moveVector = MoveVector.Create(text);

        if (moveVector != null)
        {
            MoveVectorTo(moveVector.vector1, moveVector.vector2);
            return;
        }

        SumVectors sumVectors = SumVectors.Create(text);

        if (sumVectors != null)
        {
            SumAllVectors(sumVectors.newVectorName, sumVectors.vector1, sumVectors.vector2, sumVectors.vector3, sumVectors.vector4, sumVectors.vector5);
            return;
        }

        NegativeVector negativeVector = NegativeVector.Create(text);

        if (negativeVector != null)
        {
            MakeVectorNegative(negativeVector.vectorName);
            return;
        }

        AssignNegativeVector assignNegativeVector = AssignNegativeVector.Create(text);

        if (assignNegativeVector != null)
        {
            CreateNegativeVector(assignNegativeVector.existingVectorName, assignNegativeVector.newVectorName);
            return;
        }

        VectorCommand vectorCommand = VectorCommand.Create(text);

        if (vectorCommand != null)
        {
            HandleVectorCommand(vectorCommand.command, vectorCommand.vectorName);
            return;
        }
        OffsetVector offsetVector = OffsetVector.Create(text);

        if (offsetVector != null)
        {
            OffsetVectorBy(offsetVector.vectorName, offsetVector.offsetX, offsetVector.offsetY, offsetVector.offsetZ);
            return;
        }
    }