Пример #1
0
    // Update is called once per frame
    void Update()
    {
        mMouse   = mTileMapObject.GetComponent <TileMapMouse> ();
        mTileMap = mTileMapObject.GetComponent <TileMap>();
        //Debug.Log ("Tile: " + mMouse.mMouseHitX + ", " + mMouse.mMouseHitY);
        mMouseX = mMouse.mMouseHitX;

        //fixed for negatvie Z values
        mMouseY = mMouse.mMouseHitY;
        //fixed for negatvie Z values
        if (Input.GetKey("b"))
        {
            UpdateTarget();
        }
    }
Пример #2
0
    public override void OnStartClient()
    {
        _tileMap                = GetComponent <TileMap>();
        _tileMapMouse           = (TileMapMouse)FindObjectOfType(typeof(TileMapMouse));
        _tileMapMouse.MapClick += SendTryNewWallMessage;
        _tileMapMouse.MapClick += MapClickDebug;
        _mClient                = new NetworkClient();

        NetworkServer.RegisterHandler(TryNewWallMessage.Id, netMsg =>
        {
            var msg = netMsg.ReadMessage <TryNewWallMessage>();
            StartCoroutine(WaitAndTryNewWall(msg.PosX, msg.PosY, msg.StartPosX, msg.StartPosY, msg.IsVertical));
        });
        _mClient.Connect("127.0.0.1", 7777);
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     mTileMapObject = GameObject.Find("CurrentTileMap");
     mMouse         = mTileMapObject.GetComponent <TileMapMouse> ();
     mTileMap       = mTileMapObject.GetComponent <TileMap>();
     mMouseX        = mMouse.mMouseHitX;
     //fixed for negatvie Z values
     mMouseY = mMouse.mMouseHitY;
     //fixed for negative Z values
     //instantiates the objects in this object
     mMoved = false;
     mHand  = new Hand();
     mDeck  = new Deck();
     //GameManager.AddPlayer (this);//allows gamemanager to know that a new player is active
     Debug.Log("Player Created");
 }
Пример #4
0
    void Update()
    {
        mMouse   = mTileMapObject.GetComponent <TileMapMouse> ();
        mTileMap = mTileMapObject.GetComponent <TileMap>();
        //Debug.Log ("Tile: " + mMouse.mMouseHitX + ", " + mMouse.mMouseHitY);
        mMouseX = mMouse.mMouseHitX;

        //fixed for negatvie Z values
        mMouseY = mMouse.mMouseHitY;
        //fixed for negatvie Z values

        //if (Input.GetKey ("escape"))
        //{
        //	Application.Quit ();
        //}
        if (Input.GetKey("a"))
        {
            UpdatePlayer();
        }
    }
Пример #5
0
    void Update()
    {
        if (firstTime == true)
        {
            firstTime   = false;
            mPositionX  = 0;
            mPositionY  = 0;
            mTargetTurn = false;
            if (!mManager)
            {
                if (PhotonNetwork.offlineMode)
                {
                    mTileMapObject = GameObject.Find("CurrentTileMap");
                    mManager       = GameObject.Find("GameManager").GetComponent <GameManager>();              // thats how you get infromation from the manager
                }
                else
                {
                    mTileMapObject = GameObject.Find("CurrentTileMap(Clone)");
                    mManager       = GameObject.Find("GameManager(Clone)").GetComponent <GameManager>();              // thats how you get infromation from the manager
                }
            }
            //Debug.Log ("TargetX::" + mPositionX);
            //Debug.Log ("TargetY::" + mPositionY);
            if (mTileMapObject)
            {
                mTileMap = mTileMapObject.GetComponent <TileMap>();
                //mTileMap.MapInfo.SetTileType(mPositionX,mPositionY, 5);
                Vector3 v3Temp = mTileMap.MapInfo.GetTileLocation(mMouseX, mMouseY);
                Move(v3Temp);
            }
        }
        mMouse   = mTileMapObject.GetComponent <TileMapMouse> ();
        mTileMap = mTileMapObject.GetComponent <TileMap>();
        mMouseX  = mMouse.mMouseHitX;
        mMouseY  = mMouse.mMouseHitY;
        Vector3 temp = mTileMap.MapInfo.GetTileLocation(mTowardNodeX, mTowardNodeY);

        curTargetNode.position = temp;
    }
Пример #6
0
    void Update()
    {
        //Manager Loop
        if (!mManager)
        {
            if (!PhotonNetwork.offlineMode)
            {
                //Connect the the TIleMap
                mTileMapObject = GameObject.Find("CurrentTileMap(Clone)");
                mTileMap       = mTileMapObject.GetComponent <TileMap>();

                //Connect with the Mouse
                mMouse  = mTileMapObject.GetComponent <TileMapMouse> ();
                mMouseX = mMouse.mMouseHitX;
                mMouseY = mMouse.mMouseHitY;

                mManager = GameObject.Find("GameManager(Clone)").GetComponent <GameManager>();
                mManager.AddPlayer(this);                 //allows gamemanager to know that a new player is active
            }
            else
            {
                //Connect the the TIleMap
                mTileMapObject = GameObject.Find("CurrentTileMap");
                mTileMap       = mTileMapObject.GetComponent <TileMap>();

                //Connect with the Mouse
                mMouse   = mTileMapObject.GetComponent <TileMapMouse> ();
                mMouseX  = mMouse.mMouseHitX;
                mMouseY  = mMouse.mMouseHitY;
                mManager = GameObject.Find("GameManager").GetComponent <GameManager>();
                mManager.AddPlayer(this);                 //allows gamemanager to know that a new player is active
            }
        }

        //Grabing the Current Mouse and Tile Information
        mMouse   = mTileMapObject.GetComponent <TileMapMouse>();
        mTileMap = mTileMapObject.GetComponent <TileMap>();
        mMouseX  = mMouse.mMouseHitX;
        mMouseY  = mMouse.mMouseHitY;
        //Debug.Log ("MouseX Info: " + mMouse.mMouseHitX );
        //Debug.Log ("MouseY Info: " + mMouse.mMouseHitY );
        //Put Player on Map at Starting Position
        Teleport(mPositionX, mPositionY);
        //Quick button checks

        //Update the whole player function
        //Wall building code
        //Wall building code
        if (Input.GetKey("o"))
        {
            int temp = mTileMap.MapInfo.XYToIndex(mMouseX, mMouseY);
            int x    = 0;
            int y    = 0;
            mTileMap.MapInfo.IndexToXY(temp, out x, out y);
            DTileMap.TileType tempType = mTileMap.MapInfo.GetTileType(x, y);
            Debug.Log("Player:Index" + temp + " x: " + x + " y: " + y + " TileType: " + tempType);
        }
        //if (Input.GetKey ("p"))
        //{
        //	mTileMap.MapInfo.SetTileType(mMouseX,mMouseY, DTileMap.TileType.Floor, true);
        //}
        //if(Input.GetMouseButtonDown(0))
        //{
        //	if(Input.GetMouseButtonUp(0))
        //	{
        //		if(mClick)
        //		{
        //			mMouseClickPhase++;
        //		}
        //	}
        //}
    }
Пример #7
0
 // Use this for initialization
 void Start()
 {
     tile = mouseTile.GetComponent <TileMapMouse>();
     arr  = new List <Vector3> ();
 }