Example #1
0
    public virtual bool HeightCalculateToBox(int fromHeight)
    {
        CanGoForward result = HeightCalculateTo(fromHeight);

        if (result == CanGoForward.Go)
        {
            return(true);
        }
        return(false);
    }
Example #2
0
    public void RightToMove()
    {
        int x = charMatrixPositionX;
        int z = charMatrixPositionZ;

        int[] reCalc = new int[2];

        Vector3 forward = Joe.transform.forward.normalized;

        reCalc[0] = Convert.ToInt32(forward.x);
        reCalc[1] = -Convert.ToInt32(forward.z);
        x        += reCalc[0];
        z        += reCalc[1];

        int          fromHeight = objectMap[charMatrixPositionZ, charMatrixPositionX].GetComponent <HeightData>().HeightCalculateFrom();
        CanGoForward result     = objectMap[z, x].GetComponent <HeightData>().HeightCalculateTo(fromHeight);

        if (result == CanGoForward.Go)
        {
            JoeControl.GoForward();
            charMatrixPositionX = x;
            charMatrixPositionZ = z;
        }
        else if (result == CanGoForward.OneDiff)
        {
            //there is a box, and he can push it
            int  fromHeightBox = objectMap[z, x].GetComponent <HeightData>().HeightCalculateFrom();
            bool boxPushResult = objectMap[z + reCalc[1], x + reCalc[0]].GetComponent <HeightData>().HeightCalculateToBox(fromHeightBox - 1);
            if (boxPushResult)
            {
                objectMap[z, x].GetComponent <HeightData>().GetTopBox().GetComponent <BoxController>().MoveToThere(Joe.transform.forward);
                objectMap[z + reCalc[1], x + reCalc[0]].GetComponent <HeightData>().AddBox(objectMap[z, x].GetComponent <HeightData>().GetTopBox());

                Transform onIt       = objectMap[z + reCalc[1], x + reCalc[0]].GetComponent <HeightData>().transform;
                int       onItNumber = objectMap[z + reCalc[1], x + reCalc[0]].GetComponent <HeightData>().GetBoxCount();
                objectMap[z, x].GetComponent <HeightData>().GetTopBox().GetComponent <BoxController>().InitOnIt(onIt, onItNumber);

                objectMap[z, x].GetComponent <HeightData>().RemoveTopBox();
                JoeControl.GoForward();
                charMatrixPositionX = x;
                charMatrixPositionZ = z;
            }
            //there is a box, but next element as high as it, or higher
            else
            {
                return; //TODO: animation
            }
        }
        else
        {
            return; //TODO: animation
        }
    }
Example #3
0
        public string Get(string propertyName)
        {
            switch (propertyName)
            {
            //ELEMENT
            case nameof(ClassId):
                return(ClassId.ToString());

            case nameof(AutomationId):
                return(AutomationId.ToString());

            case nameof(Id):
                return(Id.ToString());

            case nameof(StyleId):
                return(StyleId.ToString());

            //VISUAL ELEMENT
            case nameof(AnchorX):
                return(AnchorX.ToString());

            case nameof(AnchorY):
                return(AnchorY.ToString());

            case nameof(BackgroundColor):
                return(BackgroundColor.ToHex());

            case nameof(Width):
                return(this.Width.ToString());

            case nameof(Height):
                return(this.Height.ToString());

            case nameof(IsEnabled):
                return(IsEnabled.ToString());

            case nameof(WidthRequest):
                return(this.WidthRequest.ToString());

            case nameof(HeightRequest):
                return(this.HeightRequest.ToString());

            case nameof(IsFocused):
                return(IsFocused.ToString());

            case nameof(IsVisible):
                return(IsVisible.ToString());

            case nameof(InputTransparent):
                return(InputTransparent.ToString());

            case nameof(X):
                return(this.X.ToString());

            case nameof(Y):
                return(this.Y.ToString());

            case nameof(Opacity):
                return(this.Opacity.ToString());

            case nameof(TranslationX):
                return(this.TranslationX.ToString());

            case nameof(TranslationY):
                return(this.TranslationY.ToString());

            case nameof(Rotation):
                return(this.Rotation.ToString());

            case nameof(RotationX):
                return(this.RotationX.ToString());

            case nameof(RotationY):
                return(this.RotationY.ToString());

            case nameof(Scale):
                return(this.Scale.ToString());

            //VIEW
            case nameof(Margin):
                return(this.Margin.ToString());

            case nameof(VerticalOptions):
                return(this.VerticalOptions.ToString());

            case nameof(HorizontalOptions):
                return(this.HorizontalOptions.ToString());

            //WEBVIEW
            case nameof(CanGoBack):
                return(CanGoBack.ToString());

            case nameof(CanGoForward):
                return(CanGoForward.ToString());

            default:
                return(string.Empty);
            }
        }