Exemplo n.º 1
0
    public void Awake()
    {
        bool flag = BasePV != null;

        if (flag)
        {
            BasePV.observed       = this;
            this.barrel           = base.transform.Find("Barrel");
            this.correctPlayerPos = base.transform.position;
            this.correctPlayerRot = base.transform.rotation;
            this.correctBarrelRot = this.barrel.rotation;
            bool isMine = BasePV.IsMine;
            if (isMine)
            {
                this.firingPoint  = this.barrel.Find("FiringPoint");
                this.ballPoint    = this.barrel.Find("BallPoint");
                this.myCannonLine = this.ballPoint.GetComponent <LineRenderer>();
                bool flag2 = base.gameObject.name.Contains("CannonGround");
                if (flag2)
                {
                    this.isCannonGround = true;
                }
            }
            bool isMasterClient = PhotonNetwork.IsMasterClient;
            if (isMasterClient)
            {
                PhotonPlayer owner = BasePV.owner;
                bool         flag3 = RCManager.allowedToCannon.ContainsKey(owner.ID);
                if (flag3)
                {
                    this.settings = RCManager.allowedToCannon[owner.ID].settings;
                    BasePV.RPC("SetSize", PhotonTargets.All, new object[]
                    {
                        this.settings
                    });
                    int viewID = RCManager.allowedToCannon[owner.ID].viewID;
                    RCManager.allowedToCannon.Remove(owner.ID);
                    CannonPropRegion component = PhotonView.Find(viewID).gameObject.GetComponent <CannonPropRegion>();
                    bool             flag4     = component != null;
                    if (flag4)
                    {
                        component.disabled  = true;
                        component.destroyed = true;
                        PhotonNetwork.Destroy(component.gameObject);
                    }
                }
                else
                {
                    bool flag5 = !owner.IsLocal;// && !FengGameManagerMKII.instance.restartingMC;
                    if (flag5)
                    {
                        //TO DO
                        //FengGameManagerMKII.instance.kickPlayerRC(owner, false, "spawning cannon without request.");
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    public void Awake()
    {
        if (!(base.photonView != null))
        {
            return;
        }
        base.photonView.observed = this;
        barrel           = base.transform.Find("Barrel");
        correctPlayerPos = base.transform.position;
        correctPlayerRot = base.transform.rotation;
        correctBarrelRot = barrel.rotation;
        if (base.photonView.isMine)
        {
            firingPoint  = barrel.Find("FiringPoint");
            ballPoint    = barrel.Find("BallPoint");
            myCannonLine = ballPoint.GetComponent <LineRenderer>();
            if (base.gameObject.name.Contains("CannonGround"))
            {
                isCannonGround = true;
            }
        }
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        PhotonPlayer owner = base.photonView.owner;

        if (FengGameManagerMKII.Instance.allowedToCannon.ContainsKey(owner.Id))
        {
            settings = FengGameManagerMKII.Instance.allowedToCannon[owner.Id].settings;
            base.photonView.RPC("SetSize", PhotonTargets.All, settings);
            int viewID = FengGameManagerMKII.Instance.allowedToCannon[owner.Id].viewID;
            FengGameManagerMKII.Instance.allowedToCannon.Remove(owner.Id);
            CannonPropRegion component = PhotonView.Find(viewID).gameObject.GetComponent <CannonPropRegion>();
            if (component != null)
            {
                component.disabled  = true;
                component.destroyed = true;
                PhotonNetwork.Destroy(component.gameObject);
            }
        }
        else if (!owner.isLocal && !FengGameManagerMKII.Instance.restartingMC)
        {
            FengGameManagerMKII.Instance.KickPlayer(owner, ban: false, "spawning cannon without request.");
        }
    }