public static Vector3 GetDirection(Vector3Direction vector3Direction)
        {
            switch (vector3Direction)
            {
            case Vector3Direction.Up:
                return(Vector3.up);

            case Vector3Direction.Down:
                return(Vector3.down);

            case Vector3Direction.Right:
                return(Vector3.right);

            case Vector3Direction.Left:
                return(Vector3.left);

            case Vector3Direction.Foward:
                return(Vector3.forward);

            case Vector3Direction.Back:
                return(Vector3.back);

            default:
                return(Vector3.zero);
            }
        }
        public static Vector3 GetTransformDirection(this Transform transform, Vector3Direction vector3Direction)
        {
            switch (vector3Direction)
            {
            case Vector3Direction.Up:
                return(transform.up);

            case Vector3Direction.Down:
                return(-transform.up);

            case Vector3Direction.Right:
                return(transform.right);

            case Vector3Direction.Left:
                return(-transform.right);

            case Vector3Direction.Foward:
                return(transform.forward);

            case Vector3Direction.Back:
                return(-transform.forward);

            default:
                return(Vector3.zero);
            }
        }
        Vector3 Getvectordirection(Vector3 direction, Vector3Direction type)
        {
            switch (type)
            {
            case Vector3Direction.up:
                direction          = new Vector3(0, 1, 0);
                positionObjectbool = false;
                return(direction);

            case Vector3Direction.right:
                direction          = new Vector3(1, 0, 0);
                positionObjectbool = false;
                return(direction);

            case Vector3Direction.left:
                direction          = new Vector3(-1, 0, 0);
                positionObjectbool = false;
                return(direction);

            case Vector3Direction.forward:
                direction          = new Vector3(0, 0, 1);
                positionObjectbool = false;
                return(direction);

            case Vector3Direction.down:
                direction          = new Vector3(0, -1, 0);
                positionObjectbool = false;
                return(direction);

            case Vector3Direction.back:
                direction          = new Vector3(0, 0, -1);
                positionObjectbool = false;
                return(direction);

            case Vector3Direction.other:
                positionObjectbool = true;
                return(direction);
            }

            return(direction);
        }
Example #4
0
 public override void Reset()
 {
     vector3Variable = null;
     direction       = Vector3Direction.Up;
 }
Example #5
0
 public static Vector3Axial GetNeighbour(this Vector3Axial a, Vector3Direction neighbourDirection)
 {
     return(a + Directions[(int)neighbourDirection]);
 }
    void Awake()
    {
        st = this ;
        //Rect r =new Rect();
        _stepMoveDistince = 0.166667f/16.0f ;
        _minDistince   =   _stepMoveDistince * 2;

        Vector3 _down  = transform.TransformDirection( Vector3.down ) ;
        Vector3 _up    = transform.TransformDirection( Vector3.up ) ;
        Vector3 _left  = transform.TransformDirection( Vector3.left ) ;
        Vector3 _right = transform.TransformDirection( Vector3.right ) ;

        //Vector3 _down  = transform.TransformDirection( Vector3.down ) ;
        //Vector3 _up    = transform.TransformDirection( Vector3.up ) ;
        _up_down = new Vector3[2];
        _up_down [0] = _up;
        _up_down [1] = _up;

        Vector3Direction vdown = new Vector3Direction(_down, 0.166667f  + _minDistince );
        Vector3Direction vup = new Vector3Direction(_up, 0.166667f  + _minDistince );

        Vector3Direction vleft = new Vector3Direction( _left ,  _minDistince );
        Vector3Direction vright = new Vector3Direction( _right ,  _minDistince );

        _listDirection.Add(vdown) ;
        _listDirection.Add(vright) ;
        //_listDirection.Add(_up) ;
        _listDirection.Add(vleft) ;

        _isGameOver = false ;
        _isEditing  = false  ;
        _status = PlayingStatus.Normal ;
        _gridWidth =( Screen.width /1024.0f) * _gridWidth;

        _layerFlashMask    = 1 << LayerMask.NameToLayer("flash") ;
        _layerFlash = LayerMask.NameToLayer("flash") ;
        _layerNormal =  LayerMask.NameToLayer("normal") ;

        float _width = _gridWidth ;

        // x 21 y 100
        _Maps = new IGMaps[16,108];
        for(int i = 0 ;i <16 ; i++ )
        {
            //_Maps[i] = new ObjectsMap[100] ;
            for(int j = 0 ; j < 108 ; j++ )
            {
                _Maps[i,j] = new IGMaps() ;
                _Maps[i,j].x = i ;
                _Maps[i,j].y = j ;

                //_gameMaps[i][j].ObjectPoint    = new Vector2(  _width * i + _width/2 ,_width*j + _width/2 ) ;

                _Maps[i,j].position = Camera.main.ScreenToWorldPoint ( new Vector3( _width * i + _width/2 , _screenHeigh - (_width*j+_width/2)  ,2.0f ) ) ;
                Vector3 v3=  Camera.main.ScreenToWorldPoint ( new Vector3( _width * i  , _screenHeigh - ( _width*j )  ,2.0f ) ) ;
                _Maps[i,j].rect = new Rect(v3.x,v3.y,0.1666667f,0.1666667f);

                //Camera.main.WorldToScreenPoint
                //_gameMaps[i][j].
                // _gameMaps[i][j].ObjectPosition = Camera.main.ScreenToWorldPoint ( new Vector3( _width * i + _width/2 , 768 - (_width*j+_width/2)  ,2.0f ) ) ;

            }
        }

        /*
        for(int j = 0 ; j < 100 ; j++ )
        {
            Vector3 v3 = Camera.main.ScreenToWorldPoint ( new Vector3( 0 , 0 - (_width*j+_width/2)  ,2.0f ) ) ;
            Rect r =new Rect(0,0,0.166667f,0.166667f);
            Ylist.Add( j ,v3.y );
            print( v3.y ) ;
        }
        */

         // x=-1.166667,y=-0.8333333
         // 64x=-1.166667,64y=0.1666667,0x=-1.333333,0y=0,1024x=1.333333,768y=2
        Vector3 v64 = Camera.main.ScreenToWorldPoint ( new Vector3( 64.0f , 64.0f ,2.0f ) ) ;
        Vector3 v0 = Camera.main.ScreenToWorldPoint ( new Vector3( 0f , 0f ,2.0f ) ) ;
        Vector3 v1024 = Camera.main.ScreenToWorldPoint ( new Vector3( 1024f , 768f ,2.0f ) ) ;

        print( string.Format( "64x={0},64y={1},0x={2},0y={3},1024x={4},768y={5}",v64.x ,v64.y ,v0.x , v0.y  ,v1024.x ,v1024.y  ) ) ;

        StartCoroutine(FlashingOffset());
        //	GameObject _object = (GameObject)Instantiate(_Prefab);
        //	_object.transform.position = _gameMaps[3][8].ObjectPosion ;
    }
 public override void Reset()
 {
     vector3Variable = null;
     direction = Vector3Direction.Up;
 }