Ejemplo n.º 1
0
 public ControllerPlayer(ViewPlayer player)
 {
     model          = new ModelPlayer();
     inputComponent = new InputComponent(this);
     view           = GameObject.Instantiate(player.gameObject, model.position, Quaternion.identity, null).GetComponent <ViewPlayer>();
     view.SetController(this);
 }
Ejemplo n.º 2
0
 public ControllerPlayer(GameObject player, Vector3 spawnPoint, Controls controls)
 {
     this.view  = GameObject.Instantiate(player, spawnPoint, Quaternion.identity, null).GetComponent <ViewPlayer>();
     this.model = new ModelPlayer(controls);
     view.SetController(this);
     inputComponent = new InputComponent(this);
 }
Ejemplo n.º 3
0
        public async void OnNavigatedTo(INavigationParameters parameters)
        {
            if (App.User == null)
            {
                var response = parameters.GetValue <Player>("player");

                var user = new ViewPlayer
                {
                    Id        = response.Id,
                    FirstName = response.FirstName,
                    LastName  = response.LastName,
                    Picture   = response.Picture,
                    Login     = response.Login
                };

                App.User = user;
            }

            this.User = App.User;
            AllInfo   = await _playerService.GetMobileInfo(this.User.Id);

            PreviousGames = new ObservableCollection <Game>(AllInfo.Where(g => AllInfo.IndexOf(g) != 0));
            var actualGame = AllInfo.Where(g => DateTime.Now >= g.CreationDate && g.FinalTime == null).ToList();

            if (actualGame == null && !actualGame.Any())
            {
                IsInGame = false;
            }
            else
            {
                IsInGame = true;
            }
        }
        private void butCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            ViewPlayer player = new ViewPlayer();

            player.Show();
        }
Ejemplo n.º 5
0
 public ControllerPlayer(ModelPlayer pModel, ViewPlayer pView, Player pPlayer, Transform pCamara)
 {
     _model        = pModel;
     _view         = pView;
     _player       = pPlayer;
     _model.Shoot += _player.ShootByType;
     _camara       = pCamara;
 }
Ejemplo n.º 6
0
    public ViewPlayer generate_other_viewPlayer(int clientID)
    {
        GameObject instance = spawn_view_player(clientID);
        ViewPlayer v_player = instance.GetComponent <ViewPlayer>();

        viewPlayers.Add(clientID, v_player);

        return(v_player);
    }
Ejemplo n.º 7
0
    public void Awake()
    {
        bulletPool = GetComponent <NormalBulletGenerator>();
        misilPool  = GetComponent <MisilBulletGenerator>();

        view              = new ViewPlayer();
        model             = new ModelPlayer(this.transform, shield);
        controller        = new ControllerPlayer(model, view, this, camara);
        automaticStrategy = new Automatic(canShot, fireRate, bullet, mainGun, bulletPool);
        tripleStrategy    = new Triple(canShot, fireRate, bullet, mainGun, sideGunL, sideGunR, bulletPool);
        misilStrategy     = new Misil(canShot, fireRate, bullet, mainGun, sideGunL, sideGunR, bulletPool, misilGunL, misilGunR, misilPool);
    }
Ejemplo n.º 8
0
    public void OnShootJudging(ViewPlayer origin_viewPlayer, Ray shootRay)
    {
        RaycastHit hit;

        //   origin_viewPlayer.Animator.SetBool("isShooting", true);
        origin_viewPlayer.Shoot();
        if (Physics.Raycast(shootRay, out hit, 500f, shootableMask))
        {
            ViewPlayer hit_viewPlayer = hit.collider.GetComponent <ViewPlayer>();

            if (hit_viewPlayer != null)
            {
                Debug.Log("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& hit_viewPlayer.connectID = " + hit_viewPlayer.connectID + "origin_viewPlayer.connectID =  " + origin_viewPlayer.connectID);
                if (hit_viewPlayer.connectID == origin_viewPlayer.connectID)//原来的Player发出的打到了自己身上
                {
                }
                else
                {
                    hit_viewPlayer.TakeDamage();
                }
            }
        }
        //    origin_viewPlayer.Animator.SetBool("isShooting", false);
    }
Ejemplo n.º 9
0
 public void bind_view_player(ViewPlayer viewPlayer)
 {
     this.viewPlayer           = viewPlayer;
     this.viewPlayer.connectID = connectID;
 }
Ejemplo n.º 10
0
 public void bind_currentViewPlayer(ViewPlayer currentViewPlayer)
 {
     this.currentViewPlayer = currentViewPlayer;
 }
Ejemplo n.º 11
0
 public void OnNavigatedTo(INavigationParameters parameters)
 {
     ActualGame = parameters.GetValue <Game>("allInfo");
     User       = parameters.GetValue <ViewPlayer>("user");
     ActualStep = parameters.GetValue <ViewStep>("step");
 }