Exemplo n.º 1
0
 public bool ConnectToMainWoW(string windowTitle)
 {
     GameEnabled = false;
     radarctrl   = new RadarControl();
     mainwow     = new WoWConnection(windowTitle);
     if (!mainwow.TryToConnect())
     {
         throw new Exception();
     }
     mainPlayer  = new WoWPlayer(mainwow.Connection.ReadUInt64((uint)mainwow.Connection.MainModule.BaseAddress + MemoryOffsets.GlobalInfoPlayerGUID));
     GameEnabled = true;
     return(true);
 }
Exemplo n.º 2
0
    //子弹碰撞时爆炸
    void OnCollisionEnter(Collision collisionInfo)
    {
        /*foreach (ContactPoint contact in collisionInfo.contacts)
         * {
         *  Debug.DrawRay(contact.point, contact.normal, Color.white);
         * }*/
        if (isFirstCollision == 0)
        {
            return;
        }
        isFirstCollision = 0;
        Vector3 hitPos = collisionInfo.contacts[0].point;

        Debug.Log("Bullet Hit Point:" + hitPos);
        //Following Code will be executed in every client
        //Just to show the tag in radarPoint
        RadarControl radar = GameObject.Find("GameController").GetComponent <RadarControl>();

        radar.CreateBombTag(hitPos, gameObject.transform.rotation, PhotonView.Find(shooterViewID).GetComponent <TankControl>().flag);

        //Only executed in the owner of the bullet
        if (!photonView.isMine)
        {
            return;
        }
        //Notice: collisionInfo.gameObject will return the most upper level object,in this case,"tank1(Clone)"
        string     hitPart = collisionInfo.collider.gameObject.name;
        TankBody   hitBody;
        GameObject hitObj;

        if (collisionInfo.collider.transform.parent != null)
        {
            hitObj = collisionInfo.collider.transform.parent.gameObject;
        }
        else
        {
            hitObj = null;
        }

        //If have hit a tank
        if (hitObj != null && hitObj.tag == "Player")
        {
            switch (hitPart)
            {
            case "Bottom": hitBody = TankBody.Bottom; break;

            case "Turret": hitBody = TankBody.Turret; break;

            default: hitBody = TankBody.IsNotTankBody; break;
            }

            HitInfo shooterSideInfo = new HitInfo();
            shooterSideInfo.shooterDamage    = (ushort)damage;
            shooterSideInfo.shooterViewID    = (ushort)shooterViewID;
            shooterSideInfo.shooterNetworkID = (byte)photonView.ownerId;
            shooterSideInfo.hitPart          = hitBody;
            //Make a RPC call to hitObject's owner
            hitObj.GetPhotonView().RPC("RPCTakeDamage", hitObj.GetPhotonView().owner, shooterSideInfo.ToBytes());
            PhotonNetwork.Instantiate(bigExplosion.name, hitPos, transform.rotation, 0);
            //DestroySelf
            PhotonNetwork.Destroy(gameObject);
            return;
        }
        //If just hit the ground
        //添加爆炸效果
        PhotonNetwork.Instantiate(explosion.name, hitPos, transform.rotation, 0);
        //摧毁自身
        PhotonNetwork.Destroy(gameObject);
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     radarControl = GetComponent <RadarControl>();
 }