Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     generalMagnager = MRPM_GeneralManager._instance;
     oscIn           = GetComponent <OscIn>();
     oscOut          = GetComponent <OscOut>();
     authStream      = oscIn.onAnyMessage.AsObservable();
 }
Beispiel #2
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     gm    = MRPM_GeneralManager._instance;
     oscIn = GetComponent <OscIn>();
     oscIn.Open(gm.PORT_OPERATOR, null);
     oscIn.Map(gm.ADDRESS_SYNC, ParseOscMessage);
     SceneVariables = new ReactiveDictionary <int, string>();
     //新しいオブジェクトを生成
     SceneVariables.ObserveAdd().Subscribe(x =>
     {
         SpawnSyncedObject(x);
     });
 }
 // Use this for initialization
 void Start()
 {
     gm = MRPM_GeneralManager._instance;
     if (_oscOutToMain)
     {
         _oscOutToMain.Open(gm.PORT_MAINRCV, gm.mainHostAddress);
     }
     if (_oscOutToRobot)
     {
         _oscOutToRobot.Open(gm.PORT_ROBOT, gm.myRobotAddress);
     }
     robotID = gm.myRobotID;
 }
Beispiel #5
0
        // Use this for initialization
        void Start()
        {
            gm       = MRPM_GeneralManager._instance;
            Energy   = new ReactiveProperty <int>(100);
            HitPoint = new ReactiveProperty <int>(100);
            IsDead   = new ReactiveProperty <int>(0);

            HitPoint.ObserveEveryValueChanged(x => x.Value).Buffer(2)
            .Subscribe(x =>
            {
                if (x[0] - x[1] > 0)
                {
                    // regenerating
                    if (isMine)
                    {
                    }
                }
                else
                {
                    // damaged
                    if (isMine)
                    {
                    }
                }
                //update health bar
                _healthBar.value = x[0];
            });

            var isDeadStream = IsDead.ObserveEveryValueChanged(x => x.Value);

            isDeadStream.Subscribe(
                x =>
            {
                if (x > 0)
                {
                    if (isMine)
                    {
                        // show death timer
                        _hudController.ShowDeathTimer(IsDead.Value);
                    }
                    _deathEffect.Play();
                }
                else
                {
                    // revive
                    if (isMine)
                    {
                        // remove death screen
                        _hudController.ShowDeathTimer(IsDead.Value);
                    }
                    // show revive effect
                    //
                }
            });

            /*MRPM_SceneSyncManager._instance.SceneVariables
             * .ObserveEveryValueChanged(x => x)
             * .Subscribe(x =>
             * {
             *      Sync(x);
             * })
             * .AddTo(this);*/

            Observable.EveryUpdate()
            .Subscribe(_ =>
            {
                Sync(MRPM_SceneSyncManager._instance.SceneVariables);
            })
            .AddTo(this);

            if (isMine)
            {
                _hudController = MRPM_HUDController._instance;
            }
        }