コード例 #1
0
 private void Start()
 {
     this.m_CharacterController = base.GetComponent <CharacterController>();
     this.m_Animator            = base.GetComponent <Animator>();
     this.m_PhotonView          = base.GetComponent <PhotonView>();
     this.m_TransformView       = base.GetComponent <PhotonTransformView>();
 }
コード例 #2
0
    private static void initSceneObject()
    {
        // init a new game object with photon transform view
        GameObject gameObject = new GameObject("PhotonGameObject");

        gameObject.transform.position = Vector3.zero;
        PhotonTransformView transformView = gameObject.AddComponent <PhotonTransformView>() as PhotonTransformView;

        if (transformView != null)
        {
            PhotonView view = gameObject.GetPhotonView() as PhotonView;
            if (view == null)
            {
                Debug.LogError("Please add photon view component to this game object manually.");
            }
            // set synchronization attributes
            transformView.m_PositionModel.SynchronizeEnabled = true;
            transformView.m_RotationModel.SynchronizeEnabled = true;
            transformView.m_ScaleModel.SynchronizeEnabled    = true;

            // add transfer view to the observed list
            List <Component> tempComponents = view.ObservedComponents;
            if (tempComponents == null)
            {
                tempComponents = new List <Component>();
            }
            tempComponents.Add(transformView);

            // update observed option
            view.ObservedComponents = tempComponents;
            view.synchronization    = ViewSynchronization.UnreliableOnChange;
        }
    }
コード例 #3
0
            //    private GameObject[] AttackObjs;
            //    public int AttackLag;
            //    public float AttackLife;
            //    private int totalAttackFrames;
            //    private WaitForSeconds attackDisableDelay;
            //    public float InvicibilityFrames;
            //    private float invincibilityCount;

            //    private bool facingRight;

            //    private bool punching;
            //    public int PunchPercentAdd;
            //    public float PunchForceUp;
            //    public float PunchForceForward_Forward;
            //    public float PunchForceForward_Up;
            //    public float PunchForceDown;
            //    public float PunchForceDecel;
            //    private float punchForceUpTemp;
            //    private float punchForceForward_ForwardTemp;
            //    private float punchForceForward_UpTemp;
            //    private float punchForceDownTemp;
            //    private Dictionary<string, float> StrengthsList;
            //	private bool punchForceApplied;
            //    public float PunchDisablePerc;

            //    private float damage;

            //    private int lastHitBy;
            //    private float lastHitTime;
            //    private float lastHitForgetLength;

            //    public AudioClip DeathNoise;
            //    private AudioSource myAudioSrc;

            //    private bool isFrozen;
            //    private bool controlsPaused;
            //    private float spawnPause;
            //    private WaitForSeconds spawnPauseWait;

            //    private Animator anim;

            //    public float BoxPunch;

            /// todo GOOGLE: New keyword vs OVERRIDE
            //public void Start() {
            //    CBUG.Do("blah");
            //}

            public void Start()
            {
                _position        = new Vector2();
                _Rigibody3D      = GetComponent <Rigidbody>();
                _PhotonView      = GetComponent <PhotonView>();
                _PhotonTransform = GetComponent <PhotonTransformView>();

                ExternalForces = null;

                if (EnableDefaultGravity)
                {
                    ExternalForces += () => {
                        return(Forces.Gravity3);
                    };
                }

                if (_PhotonView.IsMine)
                {
                    tag = "PlayerSelf";
                    //_PhotonView.RPC("SetSlotNum", RpcTarget.All, NetID.ConvertToSlot(PhotonNetwork.player.ID));
                }
                jumpsRemaining = TotalJumpsAllowed;

                PM = PhotonArenaManager.Instance;
            }
コード例 #4
0
ファイル: RPGMovement.cs プロジェクト: yuvadius/need4bit
 void Start()
 {
     m_CharacterController = GetComponent<CharacterController>();
     m_Animator = GetComponent<Animator>();
     m_PhotonView = GetComponent<PhotonView>();
     m_TransformView = GetComponent<PhotonTransformView>();
 }
コード例 #5
0
ファイル: RPGMovement.cs プロジェクト: Abyzip/SurvvivalMobile
 void Start()
 {
     m_CharacterController = GetComponent <CharacterController>();
     m_Animator            = GetComponent <Animator>();
     m_PhotonView          = GetComponent <PhotonView>();
     m_TransformView       = GetComponent <PhotonTransformView>();
 }
コード例 #6
0
 protected virtual void Awake()
 {
     myTran      = transform;
     myRigidbody = GetComponent <Rigidbody>();
     ptv         = GetComponent <PhotonTransformView>();
     weaponCtrl  = GetComponent <WeaponController>();
 }
コード例 #7
0
        // -------------------------------------------

        /*
         * Awake
         */
        public void Awake()
        {
            m_photonView = GetComponent <PhotonView>();

            if (!YourNetworkTools.Instance.IsLocalGame)
            {
                if (m_photonView.InstantiationData != null)
                {
                    NetworkID.NetID = (int)(m_photonView.InstantiationData[0]);
                    NetworkID.UID   = (int)(m_photonView.InstantiationData[1]);
                }
            }
            else
            {
                if (m_photonView != null)
                {
                    m_photonView.enabled = false;
                    PhotonTransformView photonTransform = this.GetComponent <PhotonTransformView>();
                    if (photonTransform != null)
                    {
                        photonTransform.enabled = false;
                    }
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// スクリプトが開始した時の処理
 /// </summary>
 virtual protected void Start()
 {
     // 敵の元データが無いならば
     if (enemyResourceData == null)
     {
         // 敵の元データを読み込む
         enemyResourceData = Resources.Load <Entity_Sahagin>("Enemy/EnemyData/EnemyData");
     }
     // 敵の名前を設定する(継承先で設定する)
     SetName();
     // 敵のデータを読み込む
     LoadEnemyData();
     // ステータスを設定する
     if (!SetStatus() && PhotonNetwork.isMasterClient)
     {
         // エラー文を表示
         Debug.LogError(enemyName + "のステータスが設定されていません。");
         // ネットワークに接続されていたら
         if (PhotonNetwork.connected)
         {
             // ネットワーク上から削除する
             PhotonNetwork.Destroy(this.gameObject);
         }
         // ネットワークに接続されていなければ
         else
         {
             // ローカル上で削除する
             GameObject.Destroy(this.gameObject);
         }
         // 処理から抜ける
         return;
     }
     // マスタークライアントでなければ
     else if (!PhotonNetwork.isMasterClient)
     {
         // マスタークライアントにレベルと名前を送ってもらう
         RequireLevelAndNameForMaster();
     }
     // スクリプトコンポーネントのあるオブジェクトを格納する
     scripts = GameObject.FindGameObjectWithTag("Scripts");
     // アニメーションコンポーネントを取得する
     anim = gameObject.GetComponent <Animator>();
     // 通信同期のためのコンポーネントを取得する
     photonTransformView = gameObject.GetComponent <PhotonTransformView>();
     // 物理演算の為のコンポーネントを取得する
     rigBody = gameObject.GetComponent <Rigidbody>();
     // 攻撃用あたり判定コンポーネントをオフにする
     DisableAttackColliders();
     // マスタークライアントならば
     if (PhotonNetwork.isMasterClient)
     {
         // 移動速度を設定する
         moveValue.z = moveSpeed;
         // 通信同期のための移動速度を送る
         photonTransformView.SetSynchronizedValues(moveValue, 0f);
     }
     // ヘイトが一番高いプレイヤーを探す
     GetHaightHighestPlayer();
 }
コード例 #9
0
ファイル: PlayerMove.cs プロジェクト: hemuhunune/FriendlyCore
 // Start is called before the first frame update
 void Start()
 {
     photonTransformView = GetComponent <PhotonTransformView>();
     rigidbody           = GetComponent <Rigidbody2D>();
     GlobalGameManager._instance.cameraManager.player = gameObject;
     photonView = GetComponent <PhotonView>();
     _animator  = GetComponent <Animator>();
 }
コード例 #10
0
 void StartShield()
 {
     if (!photonTrans)
     {
         photonTrans = GetComponent <PhotonTransformView>();
     }
     photonTrans.enabled = true;
 }
コード例 #11
0
 void StopShield()
 {
     if (!photonTrans)
     {
         photonTrans = GetComponent <PhotonTransformView>();
     }
     photonTrans.enabled = false;
 }
コード例 #12
0
    /*public override void OnDisconnected(DisconnectCause cause)
     * {
     *
     *  Debug.Log("[PUN] Disconnected -->" + cause);
     *
     *  Debug.Log("[PUN] reconnecting to server");
     *
     *  PhotonNetwork.ReconnectAndRejoin();
     * }
     *
     * public override void OnLeftRoom() {
     *
     *  Debug.Log("[PUN] LeftRoom" );
     *
     *  OnConnectedToMaster();
     * }
     */



    //AVATAR
    //local avatar
    void InstantiateLocalAvatar()
    {
        Debug.Log("[PUN] instantiate LocalAvatar");

        GameObject player = GameObject.Find("OVRPlayerController");

        //check if an avatar attached to the OVR player controller already exist
        Transform attachedLocalAvatar = player.transform.FindDeepChild("LocalAvatar");

        if (attachedLocalAvatar != null)
        {
            Destroy(attachedLocalAvatar.gameObject);
        }

        photonView = player.AddComponent <PhotonView>();                                       //Add a photonview to the OVR player controller
        PhotonTransformView photonTransformView = player.AddComponent <PhotonTransformView>(); //Add a photonTransformView to the OVR player controller

        photonTransformView.m_SynchronizeRotation = false;
        photonView.ObservedComponents             = new List <Component>();
        photonView.ObservedComponents.Add(photonTransformView);
        photonView.Synchronization = ViewSynchronization.UnreliableOnChange; // set observeoption to unreliableonchange

        //instantiate the local avatr
        GameObject TrackingSpace = GameObject.Find("TrackingSpace");

        localAvatar = Instantiate(Resources.Load("LocalAvatar"), TrackingSpace.transform.position, TrackingSpace.transform.rotation, TrackingSpace.transform) as GameObject;
        PhotonAvatarView photonAvatrView = localAvatar.GetComponent <PhotonAvatarView>();

        photonAvatrView.photonView = photonView;
        photonAvatrView.ovrAvatar  = localAvatar.GetComponent <OvrAvatar>();
        photonView.ObservedComponents.Add(photonAvatrView);


        if (PhotonNetwork.AllocateViewID(photonView))
        {
            RaiseEventOptions raiseEventOptions = new RaiseEventOptions
            {
                CachingOption = EventCaching.AddToRoomCache,
                Receivers     = ReceiverGroup.Others
            };

            // request to all other clients in the network to create a remote
            PhotonNetwork.RaiseEvent(MasterManager.GameSettings.InstantiateVrAvatarEventCode, photonView.ViewID, raiseEventOptions, SendOptions.SendReliable);

            //OvrAvatar ovrAvatar = localAvatar.GetComponent<OvrAvatar>();
            //ovrAvatar.oculusUserID = MasterManager.GameSettings.UserID;

            Debug.Log("[PUN] LocalAvatar instantiatiation triggered now waiting for OVRAvatar to initialize");

            OvrAvatar.LocalAvatarInstantiated += LocalAvatarInstantiated;
        }
        else
        {
            Debug.LogError("[PUN] Failed instantiate LocalAvatar, Failed to allocate a ViewId.");

            Destroy(localAvatar);
        }
    }
コード例 #13
0
 // Start is called before the first frame update
 void Start()
 {
     photonTransformView = GetComponent <PhotonTransformView>();
     rmm               = FindObjectOfType <RandomMatchMaker>();
     rb                = this.gameObject.GetComponent <Rigidbody2D>();
     rbArrow           = arrow.gameObject.GetComponent <Rigidbody2D>();
     audioSource       = this.GetComponent <AudioSource>();
     multiscoremanager = FindObjectOfType <MultiScoreManager>();
 }
コード例 #14
0
ファイル: IdleRunJump.cs プロジェクト: Ralph89/SoccerRally
    // Use this for initialization
    void Start () 
    {
        animator = GetComponent<Animator>();
        m_PhotonView = GetComponent<PhotonView>();
        m_TransformView = GetComponent<PhotonTransformView>();

        if(animator.layerCount >= 2)
            animator.SetLayerWeight(1, 1);
    }
コード例 #15
0
 private void Start()
 {
     //players = MapController.players;
     _photonView    = GetComponent <PhotonView>();
     _currentPlayer = GetComponent <PlayerEntity>();
     _visual        = GetComponentInChildren <Renderer>();
     _pTransform    = GetComponent <PhotonTransformView>();
     _spawnPoints   = _gameManager.GetComponent <GameManager>()._spawnPoint;
 }
コード例 #16
0
 // Use this for initialization
 void Init()
 {
     // ヒット時の爆発パーティクルエフェクトを停止しておく
     shockEffect.Stop();
     // 通信同期用コンポーネントを取得する
     photonTransformView = GetComponent <PhotonTransformView>();
     // 魔法が出た瞬間の時間を登録する
     startTime = Time.time;
 }
コード例 #17
0
ファイル: Shock.cs プロジェクト: GochiMMO/MMO
 // Use this for initialization
 void Init()
 {
     // ヒット時の爆発パーティクルエフェクトを停止しておく
     shockEffect.Stop();
     // 通信同期用コンポーネントを取得する
     photonTransformView = GetComponent<PhotonTransformView>();
     // 魔法が出た瞬間の時間を登録する
     startTime = Time.time;
 }
コード例 #18
0
    // Use this for initialization
    void Start () 
    {
        this.animator = this.GetComponent<Animator>();
        this.m_PhotonView = this.GetComponent<PhotonView>();
        this.m_TransformView = this.GetComponent<PhotonTransformView>();

        if(this.animator.layerCount >= 2)
            this.animator.SetLayerWeight(1, 1);
    }
コード例 #19
0
        // Start is called before the first frame update
        public void AddPhotonView()
        {
            PhotonView          pv  = gameObject.AddComponent <PhotonView>();
            PhotonTransformView ptv = gameObject.AddComponent <PhotonTransformView>();

            PhotonNetwork.AllocateViewID(pv);
            pv.ObservedComponents = new List <Component>();
            pv.ObservedComponents.Add(ptv);
        }
コード例 #20
0
    // 初期化----------------------------------------------------------------------------------------------
    void Start()
    {
        PunchCollFlag          = false;
        HeadPartsPunchCollFlag = false;
        BodyPartsPunchCollFlag = false;
        ArmPartsPunchCollFlag  = false;
        LegPartsPunchCollFlag  = false;

        photonTransformView = GetComponent <PhotonTransformView>();
    }
コード例 #21
0
    public override void BindPlayerController(PlayerController playerController)
    {
        base.BindPlayerController(playerController);

        _playerMove    = playerController.gameObject.GetComponent <PlayerMove>();
        _playerJump    = playerController.gameObject.GetComponent <PlayerJump>();
        _boxCollider2D = playerController.gameObject.GetComponent <BoxCollider2D>();
        _rigidbody2D   = playerController.gameObject.GetComponent <Rigidbody2D>();
        _transformView = playerController.gameObject.GetComponent <PhotonTransformView>();
    }
コード例 #22
0
        public static void AddPhotonTransformView(PhotonView photonView, GameObject synchronizedTarget, bool syncPos = false, bool syncRot = true)
        {
            PhotonTransformView photonTransformView = synchronizedTarget.AddComponent <PhotonTransformView>();

            photonTransformView.m_SynchronizePosition = syncPos;
            photonTransformView.m_SynchronizeRotation = syncRot;
            photonTransformView.m_SynchronizeScale    = false;

            photonView.ObservedComponents.Add(photonTransformView);
        }
コード例 #23
0
    // Use this for initialization
    void Start()
    {
        int itemNum = (int)item;

        itemId = itemNum;

        rb    = GetComponent <Rigidbody>();
        ipPV  = GetComponent <PhotonView>();
        ipPTV = GetComponent <PhotonTransformView>();
    }
コード例 #24
0
 private void Start()
 {
     this.animator        = base.GetComponent <Animator>();
     this.m_PhotonView    = base.GetComponent <PhotonView>();
     this.m_TransformView = base.GetComponent <PhotonTransformView>();
     if (this.animator.layerCount >= 2)
     {
         this.animator.SetLayerWeight(1, 1f);
     }
 }
コード例 #25
0
 private void Start()
 {
     m_PhotonView    = GetComponent <PhotonView>();
     m_TransformView = GetComponent <PhotonTransformView>();
     if (m_PhotonView.isMine)
     {
         Camera.main.transform.parent        = head.transform;
         Camera.main.transform.localPosition = head.localPosition;
     }
 }
コード例 #26
0
    void Awake()
    {
        if (photonTV != null)
        {
            return;
        }

        photonTV = gameObject.AddComponent <PhotonTransformView>();
        photonView.ObservedComponents.Add(photonTV);
    }
コード例 #27
0
ファイル: GameManager.cs プロジェクト: NateLemke/Trieris
    /// <summary>
    /// Instantiates a new ship into the game world for the given team on the given node
    /// </summary>
    /// <param name="node">the node to place the ship</param>
    /// <param name="team">the team the ship is assigned to</param>
    /// <returns>A reference to the newly created ship</returns>
    public Ship spawnShip(Node node, Team team)
    {
        GameObject parent = GameObject.Find("Ships");

        if (parent == null)
        {
            parent      = Instantiate(new GameObject());
            parent.name = "Ships";
        }
        GameObject shipPrefab = Resources.Load("Prefabs/Ship") as GameObject;

        GameObject spawn = Instantiate(shipPrefab, node.getRealPos(), Quaternion.identity);

        Ship ship = spawn.GetComponent <Ship>();

        PhotonView          pv  = spawn.AddComponent <PhotonView>();
        PhotonTransformView ptv = spawn.AddComponent <PhotonTransformView>();

        pv.ObservedComponents = new List <Component>();
        pv.ObservedComponents.Add(ptv);
        pv.OwnershipTransfer = OwnershipOption.Takeover;
        pv.Synchronization   = ViewSynchronization.Unreliable;
        //pv.ViewID = (int)(team.TeamFaction+1) * 100 + (ship.Id+1) * 10;

        if (PhotonNetwork.IsConnected)
        {
            if (PhotonNetwork.IsMasterClient)
            {
                if (!PhotonNetwork.AllocateSceneViewID(pv))
                {
                    Debug.LogError("Failed to allocated viewID for ship");
                }
            }
            else
            {
                pv.TransferOwnership(PhotonNetwork.MasterClient);
            }
        }

        //    Debug.Log((int)(team.TeamFaction + 1) * 100 + (ship.Id + 1) * 10);
        //Debug.Log(pv.ViewID);

        if (PhotonNetwork.IsConnected && !PhotonNetwork.IsMasterClient)
        {
            pv.TransferOwnership(PhotonNetwork.MasterClient);
            //spawn = PhotonNetwork.Instantiate("Prefabs/Ship",node.getRealPos(),Quaternion.identity);
        }

        spawn.transform.parent = parent.transform;

        ship.intialize(team, node);
        ship.name = team.TeamFaction.ToString() + " ship " + ship.Id;

        return(ship);
    }
コード例 #28
0
    public void WeaponAtrributeRPC(int id)
    {
        GameObject go;

        GameObject[] player = GameObject.FindGameObjectsWithTag("Player");
        for (int i = 0; i < player.Length; i++)
        {
            if (player[i].GetComponent <PhotonView>().ViewID == id)
            {
                go = player[i];
                HandOfPlayer[] hand = go.transform.GetComponentsInChildren <HandOfPlayer>();
                foreach (var item in hand)
                {
                    //if (Weaponhandtype == HandType.Left && item.handType == HandType.Left)
                    //{
                    //    transform.SetParent(item.transform);
                    //    transform.localPosition = Vector3.zero;
                    //    transform.localEulerAngles = Vector3.zero;

                    //}
                    //else if (Weaponhandtype == HandType.Right && item.handType == HandType.Right)
                    //{
                    //    transform.SetParent(item.transform);
                    //    transform.localPosition = Vector3.zero;
                    //    transform.localEulerAngles = Vector3.zero;

                    //}

                    if (item.handType == HandType.Right)
                    {
                        if (Weaponhandtype == HandType.Right)
                        {
                            Debug.Log("我的武器类型是:" + WeaponType + ",我放在了右手上");
                            transform.SetParent(item.transform);
                            transform.localPosition    = Vector3.zero;
                            transform.localEulerAngles = Vector3.zero;
                        }
                    }
                    else if (item.handType == HandType.Left)
                    {
                        if (Weaponhandtype == HandType.Left)
                        {
                            Debug.Log("我的武器类型是:" + WeaponType + ",我放在了左手上");
                            transform.SetParent(item.transform);
                            transform.localPosition    = Vector3.zero;
                            transform.localEulerAngles = Vector3.zero;
                        }
                    }
                }
                // transform.SetParent(go.transform.GetComponentsInChildren<HandOfPlayer>());
            }
        }
        PhotonTransformView ptv = GetComponent <PhotonTransformView>();
    }
コード例 #29
0
    // Use this for initialization
    void Start()
    {
        animator        = GetComponent <Animator>();
        m_PhotonView    = GetComponent <PhotonView>();
        m_TransformView = GetComponent <PhotonTransformView>();

        if (animator.layerCount >= 2)
        {
            animator.SetLayerWeight(1, 1);
        }
    }
コード例 #30
0
 void Unparent()
 {
     if (!photonTrans)
     {
         photonTrans = GetComponent <PhotonTransformView>();
     }
     photonTrans.enabled = true;
     initPos             = transform.localPosition;
     initRot             = transform.rotation;
     gameObject.transform.SetParent(null);
     SetLayer(0);
 }
コード例 #31
0
 /// <summary>
 /// Reset things upon level load.
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="scenemode"></param>
 void OnLevelFinishedLoading(Scene scene, LoadSceneMode scenemode)
 {
     if (this != null && this.gameObject != null)
     {
         locview  = GetComponent <PhotonView>();
         locaudio = GetComponent <AudioSource>();
         if (locview)
         {
             locview.onSerializeTransformOption = OnSerializeTransform.All;
         }
         transformview = GetComponent <PhotonTransformView>();
         if (locview)
         {
             locview.World = GameObject.Find("Objects");
         }
         if (transformview)
         {
             transformview.World = GameObject.Find("Objects");
         }
         if (scene.name != "mptest")
         {
             curchannel     = VoiceChannel.All;
             locview.ingame = false;
         }
         else
         {
             if (crossvar == null)
             {
                 if (GameObject.Find("CrossLevelVariables"))
                 {
                     crossvar = GameObject.Find("CrossLevelVariables").GetComponent <CrossLevelVariableHolder>();
                 }
             }
             if (crossvar.Gamemode == CrossLevelVariableHolder.gamemode.TeamDeathMatch || crossvar.Gamemode == CrossLevelVariableHolder.gamemode.CapitalShip)
             {
                 curchannel = VoiceChannel.TeamOnly;
             }
             else
             {
                 curchannel = VoiceChannel.All;
             }
             if (PhotonNetwork.playerList.Length == 2)
             {
                 curchannel = VoiceChannel.All;
             }
             locview.ingame = true;
         }
     }
 }
コード例 #32
0
        void IHumanoidNetworking.DisableNetworkSync(GameObject obj)
        {
            PhotonTransformView transformView = obj.GetComponent <PhotonTransformView>();

            if (transformView != null)
            {
#if hPHOTON2
                transformView.m_SynchronizePosition = false;
                transformView.m_SynchronizeRotation = false;
#else
                transformView.m_PositionModel.SynchronizeEnabled = false;
                transformView.m_RotationModel.SynchronizeEnabled = false;
#endif
            }
        }
コード例 #33
0
    void Awake()
    {
        isFrozen = false;
        //DontDestroyOnLoad(gameObject);
        anim            = GetComponentInChildren <Animator>();
        moveRight       = 0;
        moveLeft        = 0;
        controlsPaused  = false;
        myAudioSrc      = GetComponent <AudioSource>();
        myAudioSrc.clip = DeathNoise;
        punching        = false;

        isDead        = false;
        StrengthsList = GameObject.FindGameObjectWithTag("Master").
                        GetComponent <Master>().GetStrengthList();

        CBUG.Log("Str List: " + StrengthsList.ToStringFull());
        jumpForceTemp      = 0f;
        SpeedTemp          = 0f;
        attackDisableDelay = new WaitForSeconds(AttackLife);
        facingRight        = true;
        position           = new Vector2();
        _Rigibody2D        = GetComponent <Rigidbody2D>();
        jumpsRemaining     = TotalJumpsAllowed;
        _PhotonView        = GetComponent <PhotonView>();
        _PhotonTransform   = GetComponent <PhotonTransformView>();

        AttackObjs    = new GameObject[3];
        AttackObjs[0] = transform.GetChild(3).gameObject;
        AttackObjs[1] = transform.GetChild(1).gameObject;
        AttackObjs[2] = transform.GetChild(2).gameObject;

        _MobileInput = GameObject.FindGameObjectWithTag("MobileController").GetComponent <MobileController>();

        spawnPause     = 0.5f;
        spawnPauseWait = new WaitForSeconds(spawnPause);

        lastHitBy           = -1;
        lastHitTime         = Time.time;
        lastHitForgetLength = 5;//Seconds

        if (_PhotonView.isMine)
        {
            tag = "PlayerSelf";
            _PhotonView.RPC("SetSlotNum", PhotonTargets.All, NetIDs.PlayerNumber(PhotonNetwork.player.ID));
            CamManager.SetTarget(transform);
        }
    }
コード例 #34
0
        public void Setup()
        {
            _photonView          = GetComponent <PhotonView>();
            _photonRigidbodyView = GetComponent <PhotonRigidbodyView>();
            _photonTransformView = GetComponent <PhotonTransformView>();
            _photonLiveRemote    = GetComponent <PhotonLiveRemote>();
            _photonPuntuation    = GetComponent <PhotonPuntuation>();

            _photonView.ObservedComponents.Clear();
            _photonView.ObservedComponents.Add(_photonRigidbodyView);
            _photonView.ObservedComponents.Add(_photonTransformView);
            _photonView.ObservedComponents.Add(_photonLiveRemote);
            _photonView.ObservedComponents.Add(_photonPuntuation);


            _photonView.ObservedComponents.Add(this);
        }
コード例 #35
0
    public override void OnInspectorGUI()
    {
        this.m_Target = (PhotonTransformView) target;

        DrawIsPlayingWarning();
        GUI.enabled = !Application.isPlaying;

        DrawSynchronizePositionHeader();
        DrawSynchronizePositionData();

        GUI.enabled = !Application.isPlaying;
        DrawSynchronizeRotationHeader();
        DrawSynchronizeRotationData();

        GUI.enabled = !Application.isPlaying;
        DrawSynchronizeScaleHeader();
        DrawSynchronizeScaleData();

        serializedObject.ApplyModifiedProperties();

        GUI.enabled = true;
    }
コード例 #36
0
ファイル: FireShot.cs プロジェクト: GochiMMO/MMO
 // Use this for initialization
 void Start()
 {
     photonTransformView = GetComponent<PhotonTransformView>();
     pv = gameObject.GetComponent<PhotonView>();
 }
コード例 #37
0
ファイル: EnemyData.cs プロジェクト: GochiMMO/MMO
 /// <summary>
 /// スクリプトが開始した時の処理
 /// </summary>
 protected virtual void Start()
 {
     // 敵の元データが無いならば
     if (enemyResourceData == null)
     {
         // 敵の元データを読み込む
         enemyResourceData = Resources.Load<Entity_Sahagin>("Enemy/EnemyData/EnemyData");
     }
     // 敵の名前を設定する(継承先で設定する)
     SetName();
     // 敵のデータを読み込む
     LoadEnemyData();
     // ステータスを設定する
     if (!SetStatus() && PhotonNetwork.isMasterClient)
     {
         // エラー文を表示
         Debug.LogError(enemyName + "のステータスが設定されていません。");
         // ネットワークに接続されていたら
         if (PhotonNetwork.connected)
         {
             // ネットワーク上から削除する
             PhotonNetwork.Destroy(this.gameObject);
         }
         // ネットワークに接続されていなければ
         else
         {
             // ローカル上で削除する
             GameObject.Destroy(this.gameObject);
         }
         // 処理から抜ける
         return;
     }
     // マスタークライアントでなければ
     else if (!PhotonNetwork.isMasterClient)
     {
         // マスタークライアントにレベルと名前を送ってもらう
         RequireLevelAndNameForMaster();
     }
     // スクリプトコンポーネントのあるオブジェクトを格納する
     scripts = GameObject.FindGameObjectWithTag("Scripts");
     // アニメーションコンポーネントを取得する
     anim = gameObject.GetComponent<Animator>();
     // 通信同期のためのコンポーネントを取得する
     photonTransformView = gameObject.GetComponent<PhotonTransformView>();
     // 物理演算の為のコンポーネントを取得する
     rigBody = gameObject.GetComponent<Rigidbody>();
     // 攻撃用あたり判定コンポーネントをオフにする
     DisableAttackColliders();
     // マスタークライアントならば
     if (PhotonNetwork.isMasterClient)
     {
         // 移動速度を設定する
         moveValue.z = moveSpeed;
         // 通信同期のための移動速度を送る
         photonTransformView.SetSynchronizedValues(moveValue, 0f);
     }
     // ヘイトが一番高いプレイヤーを探す
     GetHaightHighestPlayer();
 }
コード例 #38
0
ファイル: Player.cs プロジェクト: houseofkohina/ProjectDoge
    void Start()
    {
        m_Body = GetComponent<Rigidbody2D>();
        m_PhotonView = GetComponent<PhotonView>();
        photonTransformView = GetComponent<PhotonTransformView>();
        //
        fireRate = GetComponentInChildren<Weapon>().fireRate.ToString();
        playerDmg = GetComponentInChildren<Weapon>().damage.ToString();
        dogePoints = GetComponentInChildren<Weapon>().dogePoints.ToString();
        damageDealt = GetComponentInChildren<Weapon>().damageDealt.ToString();
        neededDamage = GetComponentInChildren<Weapon>().neededDamage.ToString();

        //
        RandomDoge();
    }
コード例 #39
0
ファイル: PlayerScript.cs プロジェクト: Wizk/M1421M1421O1421
 //public SmoothFollow dCamera;
 //    private int RandomIdle;
 void Start()
 {
     moveSpeed = Speed;
     destinationPosition = transform.position;
     m_PhotonView = GetComponent<PhotonView>();
     m_TransformView = GetComponent<PhotonTransformView>();
     anim = GetComponent("Animator") as Animator;
 }