コード例 #1
0
ファイル: Ship.cs プロジェクト: Oleg-Avdeev/Spaceships-PvP
    void OnPhotonInstantiate(PhotonMessageInfo info)
    {
        if (instantiationData != null)
        {
            int id = (int)instantiationData[0];
            _laneOffset = (int)instantiationData[1];
            if (id < 0 || id >= Resolver.Instance.Units.Collection.Length)
            {
                if (isMine)
                {
                    PhotonNetwork.Destroy(gameObject);
                }
                return;
            }

            _unit = Resolver.Instance.Units.Collection[id];
            if (ownerId != PhotonNetwork.masterClient.ID)
            {
                _direction = Vector3.down;
            }
            ParseIUnitInfo();
            ColorShip();

            if (isMine == PhotonNetwork.isMasterClient)
            {
                MyMothership    = Resolver.Instance.RoomController.GetMasterMothership();
                EnemyMothership = Resolver.Instance.RoomController.GetClientMothership();
            }
            else
            {
                EnemyMothership = Resolver.Instance.RoomController.GetMasterMothership();
                MyMothership    = Resolver.Instance.RoomController.GetClientMothership();
            }

            _transform.position = MyMothership.GetTransform().position;
        }
        else
        {
            if (isMine)
            {
                PhotonNetwork.Destroy(gameObject);
            }
            return;
        }
    }
コード例 #2
0
ファイル: Interceptor.cs プロジェクト: Netaum/cit-dojo-tdd
 public Interceptor(IMothership mothership,
                    ISubmarine submarine)
 {
     this.mothership = mothership;
     this.submarine  = submarine;
 }