コード例 #1
0
        private void SprawdzPoprawnoscLiczbICzyMoznaGracDalej(ModelPlayer gracz)
        {
            string liczby = txtbPodajWartosci.Text;

            gracz.WybierzLiczby(liczby);

            richtxtbPoleGry.AppendText("\n----------------------------------------------------------------");
            richtxtbPoleGry.AppendText("\nWybrano liczby: " + liczby);
            richtxtbPoleGry.AppendText("\n----------------------------------------------------------------");

            if (!(gra.SprawdzCzyWybranoPoprawneLiczby(gracz)))
            {
                gra.Wygrany          = "\nPrzegrałeś! Wybrany podciąg nie spełnia warunków: parzystości, spójności lub nie istnieje.";
                richtxtbPoleGry.Text = ("\nKONIEC GRY: " + gra.Wygrany.ToUpper());
                labelKomunikat.Text  = "";
                return;
            }

            gra.WyrzucWybraneLiczby(gracz);

            richtxtbPoleGry.AppendText("\nAktualna postać ciągu: ");
            richtxtbPoleGry.AppendText("\n");
            StringBuilder sb = new StringBuilder();

            foreach (var item in gra.TabWylosowaneLiczbyAsReadOnly)
            {
                richtxtbPoleGry.AppendText(item + " | ");
            }
            richtxtbPoleGry.AppendText("\n----------------------------------------------------------------");

            if (!(gra.SprawdzCzyMoznaKontynuowac(gracz)))
            {
                gra.Wygrany = gracz.Name;
            }
        }
コード例 #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);
 }
コード例 #3
0
ファイル: MovePlayer.cs プロジェクト: asoman/Dodgi3D
 private void OnEnable()
 {
     InputHandler.OnFingerSwipe += Move;
     curentDestination           = new Vector3();
     model      = GetComponent <ModelPlayer>();
     controller = GetComponent <CharacterController>();
 }
コード例 #4
0
    private void OpenMainView(object arg)
    {
        Dictionary <string, GameObject> dicNodeName = arg as Dictionary <string, GameObject>;
        string              playerPrefabName        = "Blade_Warrior_Prefab";
        GameObject          playerObj = dicNodeName[playerPrefabName];
        ModelAttackRoleData data      = new ModelAttackRoleData(GetModel <MPlayerData>().PlayerHP, 0.5f, 30);

        m_player           = new ModelPlayer(playerObj, data);
        m_monsterScaleFlag = GameSceneManager.DistanceToCamera(playerObj.transform.position);

        m_cameraTrans           = dicNodeName[GameConst.PlayerCamera].transform;
        m_cameraRotationY       = m_cameraTrans.rotation.eulerAngles.y;
        m_cameraHeight          = m_cameraTrans.position.y - GameConfig.CameraHeightFix;
        m_cameraToPlayerDis     = m_player.transform.position.z - m_cameraTrans.position.z;
        m_cameraToPlayerDisVec3 = m_player.transform.position - m_cameraTrans.position;

        GameView viewType = GameView.MainView;

        ViewManager.Open(GameViewInfo.GetViewName(Moudle, GameView.MainView),
                         (GameObject gameObject) => {
            m_playerView     = new PlayerView(Moudle, viewType, gameObject.GetComponent <UIPrefab>());
            Vector3 position = GameSceneManager.ToScreenPoint(playerObj.transform.position);
            position.y      += ModelRoleManager.GetModelRoleHpPosY(playerPrefabName);
            m_playerView.CreateHPProcess(playerPrefabName, position, 1, true);
        }
                         );

        EventManager.Register(GameEvent.Type.FrameUpdate, FrameUpdate);
    }
コード例 #5
0
    public void RpcSyncDamage(GameObject player, int damage)
    {
        ModelPlayer other = player.GetComponent <ModelPlayer>();

        other.health -= damage;
        if (other.health <= 0)
        {
            GameObject death = Instantiate(deathFab, other.head.position, other.transform.rotation);
            Destroy(death, 4);

            other.myCollider.SetActive(false);
            other.rb.velocity   = Vector3.zero;
            other.rb.useGravity = false;

            foreach (SkinnedMeshRenderer m in other.playerModel)
            {
                m.enabled = false;
            }

            other.gun.gameObject.SetActive(false);

            foreach (GameObject h in other.hitbox)
            {
                h.SetActive(false);
            }

            other.dead = true;
        }
    }
コード例 #6
0
 public void Init(bool right, ModelPlayer player)
 {
     direction  = right ? Vector2.right : Vector2.left;
     myPlayer   = player;
     rb         = GetComponent <Rigidbody2D>();
     initialize = true;
     Explode();
 }
コード例 #7
0
 public ControllerPlayer(ModelPlayer pModel, ViewPlayer pView, Player pPlayer, Transform pCamara)
 {
     _model        = pModel;
     _view         = pView;
     _player       = pPlayer;
     _model.Shoot += _player.ShootByType;
     _camara       = pCamara;
 }
コード例 #8
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);
    }
コード例 #9
0
        private void Rozgrywka(ModelPlayer gracz)
        {
            if (gra.CzySaJeszczeRuchy && gra.CzyWybranoPoprawneLiczbyDoWyrzucenia)
            {
                SprawdzPoprawnoscLiczbICzyMoznaGracDalej(gracz);
            }
            if (gra.CzySaJeszczeRuchy == false)
            {
                richtxtbPoleGry.Text       = ("KONIEC GRY, WYGRYWA: " + gra.Wygrany.ToUpper());
                btnWybierzWartosci.Enabled = false;
                labelKomunikat.Text        = "";

                lblPodajWartosci.Visible   = false;
                txtbPodajWartosci.Visible  = false;
                btnWybierzWartosci.Visible = false;
                labelKomunikat.Visible     = false;
            }
        }
コード例 #10
0
    void RpcSyncRespawn(GameObject player, Vector3 pos)
    {
        ModelPlayer playerScript = player.GetComponent <ModelPlayer>();

        playerScript.myCollider.SetActive(true);
        playerScript.rb.useGravity = true;

        foreach (SkinnedMeshRenderer m in playerScript.playerModel)
        {
            m.enabled = true;
        }

        playerScript.gun.gameObject.SetActive(true);

        foreach (GameObject h in playerScript.hitbox)
        {
            h.SetActive(true);
        }

        playerScript.dead   = false;
        playerScript.health = maxHealth;

        player.transform.position = pos;
    }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     mainCamera = Camera.main;
     player     = model.GetComponent <ModelPlayer>();
 }