Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
 public Interceptor(IMothership mothership,
                    ISubmarine submarine)
 {
     this.mothership = mothership;
     this.submarine  = submarine;
 }