Пример #1
0
    // Update is called once per frame
    //	void Update () {
    //
    //	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Egg")
        {
            GameObject player = other.GetComponent <EggCarry> ().playerObj;
            player.GetComponent <PlayerMove> ().MoveTo(toX, toY);
            //			Camera.main.transform.position = new Vector3 (toX, toY, Camera.main.transform.position.z);
            if (player.GetComponent <PlayerHealth>().alive)
            {
                ServerComm serverComm = player.GetComponent <ServerComm> ();
                serverComm.RequestMap();
                serverComm.MovePlayers(toX, toY);
            }
            Destroy(other.gameObject);
        }
    }
Пример #2
0
    // Update is called once per frame
//	void Update () {
//
//	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            other.GetComponent <PlayerMove> ().MoveTo(toX, toY);
//			Camera.main.transform.position = new Vector3 (toX, toY, Camera.main.transform.position.z);
            if (isEnd && other.GetComponent <PlayerHealth> ().alive)
            {
                ServerComm serverComm = other.gameObject.GetComponent <ServerComm> ();
                serverComm.RequestMap();
                serverComm.MovePlayers(toX, toY);
            }
            else
            {
                if (mapGen.gameMode == MapGen.GameMode.Steal)
                {
                    notificationText.SetTimedNotice("Steal the egg!", Color.white, 3);
                }
            }
        }
    }