////////////////////////////////////////////////

    //private void AnnoyingFuckingAngleMovementThing() // this is to fix the f*****g camera spinning around in weird angles 10% of the time when a unit moves onto a diff sided panel
    //{
    //    if (_TARGETObjectScript.objectType == CubeObjectTypes.Panel_Wall)
    //    {
    //        if (_lastPanelYAxis == -1)
    //        {
    //            _lastPanelYAxis = _TARGETPanelScript._panelYAxis;
    //            changeWallAngle = false;
    //        }
    //        else
    //        {
    //            if (_lastPanelYAxis != _TARGETPanelScript._panelYAxis)
    //            {
    //                changeWallAngle = true;
    //            }
    //            else
    //            {
    //                changeWallAngle = false;
    //            }

    //            _lastPanelYAxis = _TARGETPanelScript._panelYAxis;

    //        }
    //        Debug.Log("f**k changeWallAngle " + changeWallAngle);
    //    }
    //}

    ////////////////////////////////////////////////

    private void SetNextTarget()
    {
        _TARGETCubeID     = _nodes[locCount];
        _TARGETCubeScript = LocationManager.GetLocationScript_CLIENT(_TARGETCubeID);
        if (_TARGETCubeScript._platform_Panel_Cube.GetCubePanel != null)
        {
            _TARGETPanelScript  = _TARGETCubeScript._platform_Panel_Cube.GetCubePanel;
            _TARGETObjectScript = _TARGETPanelScript.gameObject.GetComponent <ObjectScript>();

            //AnnoyingFuckingAngleMovementThing();

            if (MovementManager._gravityActivated)
            {
                //    unitContainerTransformLOCAL.localEulerAngles = new Vector3(0, unitContainerTransformLOCAL.localEulerAngles.y, 0);
                //    unitContainerAnglesGLOBAL.localEulerAngles = new Vector3(0, 0, 0);
            }
            else
            {
                rotateInProgress = false;

                if (_TARGETObjectScript.objectType != _currObjectScript.objectType)
                {
                    rotateInProgress = true;
                }

                if (_TARGETObjectScript.objectType == _currObjectScript.objectType)
                {
                    int currPanelYAxis   = _currPanelScript._panelYAxis;
                    int targetPanelYAxis = _TARGETPanelScript._panelYAxis;

                    if (currPanelYAxis != targetPanelYAxis)
                    {
                        rotateInProgress = true;
                    }
                }
                ChangeUnitsRotation();
                ChangeCameraRotation();
            }


            if (!LocationManager.SetUnitOnCube_CLIENT(GetComponent <UnitScript>(), _TARGETCubeID))
            {
                Debug.LogWarning("units movement interrupted >> recalculating");
                moveInProgress = false;
                ResetValues();
                if (MovementManager.BuildMovementPath(_finalTargetScript))
                {
                    MovementManager.MakeActiveUnitMove_CLIENT();
                }
            }
        }
    }
Esempio n. 2
0
    ////////////////////////////////////////////////

    private void SetNextTarget()
    {
        _currTargetCubeID = _nodes[locCount];
        _currTargetScript = LocationManager.GetLocationScript_CLIENT(_currTargetCubeID);
        if (_currTargetScript._platform_Panel_Cube._panelScriptChild != null)
        {
            _currTargetPanelScript = _currTargetScript._platform_Panel_Cube._panelScriptChild;

            if (!LocationManager.SetUnitOnCube_CLIENT(GetComponent <UnitScript>(), _currTargetCubeID))
            {
                Debug.LogWarning("units movement interrupted >> recalculating");
                moveInProgress = false;
                ResetValues();
                if (MovementManager.BuildMovementPath(_finalTargetScript))
                {
                    MovementManager.MakeActiveUnitMove_CLIENT();
                }
            }
        }
    }
Esempio n. 3
0
    void OnMouseOver()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        RaycastHit hitPoint;

        if (Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), out hitPoint, 100.0F))
        {
            //Debug.Log("f**k hitPoint.gameObject " + hitPoint.transform.gameObject.name);

            if (!PlayerManager.CameraAgent.Camera_Pivot.CAMERA_MOVING)
            {
                _panelHitIndex = 0;

                int triIndex = hitPoint.triangleIndex;
                //Debug.Log("Hit Triangle index : " + hitPoint.triangleIndex);

                if (triIndex == 0 || triIndex == 1) // (if floor) To sit OnTop of panels
                {
                    _panelHitIndex = 1;

                    if (hitPoint.collider.tag == "Panel_Floor")
                    {
                        _activeCubeScript = cubeScriptLeft;
                    }

                    if (hitPoint.collider.tag == "Panel_Wall")
                    {
                        if (_panelYAxis == 0)
                        {
                            _activeCubeScript = cubeScriptRight;
                        }

                        if (_panelYAxis == 90)
                        {
                            _activeCubeScript = cubeScriptLeft;
                        }
                    }

                    if (hitPoint.collider.tag == "Panel_Angle")
                    {
                        _activeCubeScript = cubeScriptLeft;
                    }
                }
                else if (triIndex == 4 || triIndex == 5) // (if floor) To sit Underneath of panels
                {
                    _panelHitIndex = 2;

                    if (hitPoint.collider.tag == "Panel_Floor")
                    {
                        _activeCubeScript = cubeScriptRight;
                    }

                    if (hitPoint.collider.tag == "Panel_Wall")
                    {
                        if (_panelYAxis == 0)
                        {
                            _activeCubeScript = cubeScriptLeft;
                        }

                        if (_panelYAxis == 90)
                        {
                            _activeCubeScript = cubeScriptRight;
                        }
                    }

                    if (hitPoint.collider.tag == "Panel_Angle")
                    {
                        _activeCubeScript = cubeScriptRight;
                    }
                }
                else
                {
                    _activeCubeScript = null;
                    Debug.Log("Hit Triangle index NOT REGISTERED: " + triIndex);
                }



                if (MovementManager.BuildMovementPath(_activeCubeScript))
                {
                    PanelPieceChangeColor("Pink");
                    _movementPossible = true;
                }
                else
                {
                    PanelPieceChangeColor("White");
                    _movementPossible = false;
                }
            }
        }
    }
Esempio n. 4
0
    //////////////////////////////////////////////
    void OnMouseOver()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        RaycastHit hitPoint;

        if (Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), out hitPoint, 100.0F))
        {
            //Debug.Log("f**k hitPoint.gameObject " + hitPoint.transform.gameObject.name);

            if (!PlayerManager.CameraAgent.Camera_Pivot.CAMERA_MOVING)
            {
                _panelHitIndex = 0;

                int[] surface1 = new int[2] {
                    2, 3
                };                                    // << Put surface triangle Indexs in here
                int[] surface2 = new int[2] {
                    6, 7
                };                                    // << Put surface triangle Indexs in here

                int triIndex = hitPoint.triangleIndex;
                //Debug.Log("Hit Triangle index : " + hitPoint.triangleIndex);

                if (triIndex != surface1[0] && triIndex != surface1[1] && triIndex != surface2[0] && triIndex != surface2[1])
                {
                    _activeCubeScript = null;
                    Debug.Log("Hit Triangle index NOT REGISTERED: " + triIndex);
                    return;
                }

                if (hitPoint.collider.gameObject.GetComponent <PanelPieceScript>() != null)
                {
                    CubeObjectTypes panelType = hitPoint.collider.gameObject.GetComponent <ObjectScript>().objectType;

                    if (panelType == CubeObjectTypes.Panel_Floor)
                    {
                        if (triIndex == surface1[0] || triIndex == surface1[1]) // (if floor) To sit BELOW of panels
                        {
                            _activeCubeScript = cubeScriptRight;
                        }

                        if (triIndex == surface2[0] || triIndex == surface2[1]) // (if floor) To sit OnTop of panels
                        {
                            _activeCubeScript = cubeScriptLeft;
                        }
                    }

                    if (panelType == CubeObjectTypes.Panel_Wall)
                    {
                        if (triIndex == surface1[0] || triIndex == surface1[1]) // either 0 or 90 angle
                        {
                            _activeCubeScript = cubeScriptRight;
                        }

                        if (triIndex == surface2[0] || triIndex == surface2[1]) // either 0 or 90 angle
                        {
                            _activeCubeScript = cubeScriptLeft;
                        }
                    }

                    if (panelType == CubeObjectTypes.Panel_Angle)
                    {
                        if (triIndex == surface1[0] || triIndex == surface1[1]) // (if floor) To sit OnTop of panels
                        {
                            _activeCubeScript = cubeScriptRight;
                        }

                        if (triIndex == surface2[0] || triIndex == surface2[1]) // (if floor) To sit OnTop of panels
                        {
                            _activeCubeScript = cubeScriptLeft;
                        }
                    }


                    if (MovementManager.BuildMovementPath(_activeCubeScript))
                    {
                        //Debug.Log("f**k _movementPossible ");
                        //PanelPieceChangeColor("Pink");
                        _movementPossible = true;
                    }
                    else
                    {
                        //PanelPieceChangeColor("White");
                        _movementPossible = false;
                    }
                }
            }
        }
    }