Beispiel #1
0
 public cGrapple(cPlayer attTo) : base()
 {
     _grappleStuck     = false;
     _attTo            = attTo;
     _lines            = new List <Line>();
     _stickOnCollision = true;
 }
Beispiel #2
0
    public override IEnumerator PostBeginPlay()
    {
        yield return(new WaitForEndOfFrame());

        scoreKeeper = FindObjectOfType <cGameManager>();
        player      = FindObjectOfType <cPlayer>();
        yield break;
    }
Beispiel #3
0
 protected override void Start()
 {
     base.Start();
     if (player == null)
     {
         player = FindObjectOfType <cPlayer>();
     }
 }
Beispiel #4
0
 public override void Enter(cPlayer p)
 {
     Maps[currentMap][p.playerx, p.playery] = ".";
     currentMap = tomap;
     p.playerx  = tox;
     p.playery  = toy;
     Maps[currentMap][p.playerx, p.playery] = "P";
 }
Beispiel #5
0
 protected void btnSaveComments_Click(object sender, EventArgs e)
 {
     Classes.cPlayer PlayerInfo = new cPlayer(_UserID, _UserName);
     PlayerInfo.LARPResumeComments = tbLARPResumeComments.Text;
     PlayerInfo.Save();
     lblModalMessage.Text = "Your comments have been saved.";
     ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalMessage();", true);
 }
Beispiel #6
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            Classes.cPlayer PlayerInfo = new cPlayer(_UserID, _UserName);
//            hidPlayerProfileID.Value = PlayerInfo.PlayerProfileID.ToString();

            gvWaivers.DataSource = PlayerInfo.PlayerWaivers;
            gvWaivers.DataBind();

            string postBackControlName = Request.Params.Get("__EVENTTARGET");
            string eventArgument       = Request.Params.Get("__EVENTARGUMENT");

            _SelectedID = -1;

            if (postBackControlName != null)
            {
                if (postBackControlName.ToUpper().Contains("GVWAIVERS"))
                {
                    if (!int.TryParse(eventArgument, out _SelectedID))
                    {
                        _SelectedID = -1;
                    }
                }
            }

            if (_SelectedID == -1)
            {
                if (!int.TryParse(hidRowSelected.Value, out _SelectedID))
                {
                    _SelectedID = -1;
                }
            }

            if (gvWaivers.Rows.Count != 0)
            {
                if (_SelectedID != -1)
                {
                    LoadRecord(_SelectedID);
                }
                else
                {
                    if (!int.TryParse(hidRowSelected.Value, out _SelectedID))
                    {
                        _SelectedID = 0;
                    }
                    if (_SelectedID < gvWaivers.Rows.Count)
                    {
                        LoadRecord(_SelectedID);
                    }
                    else
                    {
                        LoadRecord(0);
                    }
                }
            }
        }
Beispiel #7
0
 protected void btnSaveComments_Click(object sender, EventArgs e)
 {
     Classes.cPlayer PlayerInfo = new cPlayer(_UserID, _UserName);
     PlayerInfo.MedicalComments = tbMedicalComments.Text;
     PlayerInfo.Allergies       = tbAllergies.Text;
     PlayerInfo.Save();
     lblModalMessage.Text = "Your information has been saved.";
     ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalMessage();", true);
 }
Beispiel #8
0
        public cGrapple Instantiate(cPlayer attTo)
        {
            cGrapple wep = new cGrapple(attTo);

            base.SetProps(wep);
            wep._ropeTex         = _ropeTex;
            wep._grappleShootCue = PrimalDevistation.Instance.Audio.play("GRPPLER_EXTEND_ONESHOT");
            return(wep);
        }
Beispiel #9
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            Session["ActiveLeftNav"] = "Demographics";

            if (!IsPostBack)
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LARPortal"].ConnectionString))
                {
                    conn.Open();
                    using (SqlCommand CmdStyle = new SqlCommand("select * from CMStyles where DateDeleted is null", conn))
                    {
                        SqlDataAdapter SDAStyle    = new SqlDataAdapter(CmdStyle);
                        DataTable      dtGameStyle = new DataTable();
                        SDAStyle.Fill(dtGameStyle);
                        ddlStyle.DataSource     = dtGameStyle;
                        ddlStyle.DataTextField  = "StyleName";
                        ddlStyle.DataValueField = "StyleID";
                        ddlStyle.DataBind();
                    }

                    using (SqlCommand CmdGenre = new SqlCommand("select * from CMGenres where DateDeleted is null", conn))
                    {
                        SqlDataAdapter SDAGenre = new SqlDataAdapter(CmdGenre);
                        DataTable      dtGenre  = new DataTable();
                        SDAGenre.Fill(dtGenre);
                        ddlGenre.DataSource     = dtGenre;
                        ddlGenre.DataTextField  = "GenreName";
                        ddlGenre.DataValueField = "GenreID";
                        ddlGenre.DataBind();
                    }

                    using (SqlCommand CmdRoleAlignment = new SqlCommand("select * from MDBRoleAlignments where DateDeleted is null", conn))
                    {
                        SqlDataAdapter SDARoles = new SqlDataAdapter(CmdRoleAlignment);
                        DataTable      dtRoles  = new DataTable();
                        SDARoles.Fill(dtRoles);
                        ddlRole.DataSource     = dtRoles;
                        ddlRole.DataTextField  = "Description";
                        ddlRole.DataValueField = "RoleAlignmentID";
                        ddlRole.DataBind();
                    }
                }
            }

            Classes.cPlayer PlayerInfo = new cPlayer(_UserID, _UserName);
            hidPlayerProfileID.Value = PlayerInfo.PlayerProfileID.ToString();
            var ResumeList = PlayerInfo.PlayerLARPResumes.OrderByDescending(x => x.StartDate);

            gvResumeItems.DataSource = ResumeList;
            gvResumeItems.DataBind();

            tbLARPResumeComments.Text = PlayerInfo.LARPResumeComments;
        }
        public cGrapple SpawnGrapple(cPlayer attTo, Vector2 where, Vector2 vel)
        {
            cGrapple instance = _grappleBP.Instantiate(attTo);

            instance.Position = where;
            instance.Velocity = vel;
            _activeWeapons.Add(instance);
            //RampantRollers.Instance.Audio.play("GRPPLER_EXTEND_ONESHOT");
            return(instance);
        }
Beispiel #11
0
 public void Init()
 {
     rad        = this.GetComponent <RectTransform>().sizeDelta.y * 0.3f;
     defaultPos = this.transform.position;
     isDrag     = false;
     scr_player = _player.transform.GetChild(0).GetComponent <cPlayer>();
     scr_player.SetDir(Vector2.right);
     scr_player.SetCurMoveSpeed(0);
     stickDir = JOYSTICKDIR.IDLE;
 }
Beispiel #12
0
        //Dictionary<int, cGameObject> entityMap;

        public cEntityPool(cGameScene scene, Vector2f world_size, cPlayer p_player)
        {
            this.pScene    = scene;
            this.worldSize = world_size;
            this.pPlayer   = p_player;
            this.bullets   = new List <cBullet>();
            this.monsters  = new List <cMonster>();

            this.treeMonsters = new cQuadTree <cMonster>(1, scene.World.WorldBounds);
            this.pickups      = new Dictionary <int, cPickupAble>();
            this.spatialGrid  = new cSpatialGrid(worldSize);
            //this.treeBullets = new cQuadTree<cBullet>(1, scene.World.WorldBounds);
        }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        cPlayer OTHER = collision.GetComponent <cPlayer>();

        if (OTHER == null)
        {
            return;
        }
        else if (OTHER.tag == "Player")
        {
            OTHER.GetComponent <cPlayer>().Stun();
            Destroy(gameObject);
        }
    }
        public void SpawnWeapon(cWeapon blueprint, Vector2 where, Vector2 vel, cPlayer owner)
        {
            if (blueprint.Name == "shotgun")
            {
                Vector2 normVel = new Vector2(vel.X, vel.Y);
                normVel.Normalize();
                float angle = (float)Math.Atan2(normVel.Y, normVel.X);
                float ang;
                float len = vel.Length();

                for (int i = 0; i < blueprint.NumToFire; i++)
                {
                    ang       = cMath.Rand(angle - blueprint.FireRangeAngle / 2f, angle + blueprint.FireRangeAngle / 2f);
                    normVel.Y = (float)Math.Sin(ang);
                    normVel.X = (float)Math.Cos(ang);
                    normVel  *= cMath.Rand(len * 0.8f, len);
                    cWeapon instance = blueprint.Instantiate();
                    instance.Position = where;
                    instance.Velocity = normVel;
                    instance.Owner    = owner;
                    _activeWeapons.Add(instance);
                }
            }
            else
            {
                cWeapon instance = blueprint.Instantiate();
                instance.Position = where;
                instance.Velocity = vel * instance.LaunchPower;
                instance.Owner    = owner;
                _activeWeapons.Add(instance);
            }

            if (blueprint.Name == "machinegun")
            {
                PrimalDevistation.Instance.Audio.play("GUN_SINGLE1");
            }
            if (blueprint.Name == "grenade")
            {
                PrimalDevistation.Instance.Audio.play("GRENADE_LAUNCH");
            }
            if (blueprint.Name == "rocket")
            {
                PrimalDevistation.Instance.Audio.play("rocketLaunch");
            }
            if (blueprint.Name == "shotgun")
            {
                PrimalDevistation.Instance.Audio.play("SHOTGUN_SINGLE");
            }
        }
Beispiel #15
0
        public void Update(GameTime gameTime)
        {
            List <cPlayer> activePlayers = PrimalDevistation.Instance.PlayerManager.ActivePlayers;

            if (activePlayers.Count == 0)
            {
                return;
            }

            // If there is only one player we just centre the screen on it
            if (activePlayers.Count == 1)
            {
                cPlayer p = activePlayers[0];
                _position.X = p.Position.X;
                _position.Y = p.Position.Y;
                ClampToBounds();
            }
            else // Else there is more than one player we need to do some fancy bounding code
            {
                Vector2 topLeft     = new Vector2(float.MaxValue, float.MaxValue);
                Vector2 bottomRight = new Vector2(float.MinValue, float.MinValue);

                for (int i = 0; i < activePlayers.Count; i++)
                {
                    topLeft.X     = Math.Min(topLeft.X, activePlayers[i].Position.X);
                    topLeft.Y     = Math.Min(topLeft.Y, activePlayers[i].Position.Y);
                    bottomRight.X = Math.Max(bottomRight.X, activePlayers[i].Position.X);
                    bottomRight.Y = Math.Max(bottomRight.Y, activePlayers[i].Position.Y);
                }

                Vector2 dist = bottomRight - topLeft;

                Vector2 centre = topLeft + (dist / 2);
                _position.X = centre.X;
                _position.Y = centre.Y;

                dist.X = Math.Abs(dist.X) + 300;
                dist.Y = Math.Abs(dist.Y) + 300;

                float ratioX = (_viewport.Width / dist.X);
                float ratioY = (_viewport.Height / dist.Y);

                Zoom = Math.Min(ratioX, ratioY);
                ClampToBounds();
            }
        }
Beispiel #16
0
    private void ChangeItem(bool pIsWeapon, byte pChar)
    {
        if (pIsWeapon.Equals(true))
        {
            cUtil._user._playerInfo.curWeaponId = pChar;
            scr_player.img_weapon.sprite        = cUtil._user.WeaponEquipImages[cUtil._user._playerInfo.curWeaponId];
        }
        else
        {
            cUtil._user._playerInfo.curClothId = pChar;

            Destroy(player);
            player = Instantiate(Resources.Load <GameObject>("Prefabs/Skin_cloth/Player_skin_" + cUtil._user._playerInfo.curClothId.ToString()));
            player.transform.SetParent(playerParent.transform);
            player.transform.localScale    = new Vector3(1, 1, 1);
            player.transform.localPosition = new Vector3(337, 67, 1);
            scr_player = player.transform.GetChild(0).GetComponent <cPlayer>();
            chg_tileMng.Init();
            scr_player.tileMng           = chg_tileMng;
            scr_player.obj_coolTime      = chg_obj_coolTime;
            scr_player.t_coolTime        = chg_t_coolTime;
            scr_player.img_curHp         = chg_img_curHp;
            scr_player.t_hp              = chg_t_hp;
            scr_player.sm                = chg_sm;
            scr_player.img_weapon.sprite = cUtil._user.WeaponEquipImages[cUtil._user._playerInfo.curWeaponId];
            scr_player.indicator         = chg_indicator;
            scr_player.ft                = chg_floatingText;
            chg_floatingText.Init();
            scr_player.useMng    = chg_useMng;
            scr_player.joystick  = chg_joystick;
            scr_player.dp        = chg_dp;
            chg_joystick._player = player.transform;
            chg_joystick.Init();
            chg_dp._player            = player;
            chg_skinCamObj.obj_follow = player;
            chg_attack.scr_player     = scr_player;
            chg_attack.Init();
            chg_jump.scr_player = scr_player;
            chg_dash.scr_player = scr_player;
            chg_light.HeadLight = scr_player.lightPos;

            chg_dp.Init();
        }
    }
        public void Explode(int size, Vector2 where, Vector2 direction, cPlayer owner, bool audio)
        {
            Level.AddExplosion(size, where, direction);
            AddForce(where, -(size / 64f), size * 2);
            PlayerManager.Explosion(where, size, direction, owner);

            cParticle p = new cParticle();

            if (size == 32)
            {
                p.Texture = _expFlash32; p.MaxAge = 100;
            }
            else if (size == 64)
            {
                p.Texture = _expFlash64; p.MaxAge = 300;
            }
            else if (size == 128)
            {
                p.Texture = _expFlash128; p.MaxAge = 500;
            }

            p.Position   = where;
            p.StartColor = new Color(255, 255, 255, 255);
            p.EndColor   = new Color(255, 0, 0, 0);
            ParticleEffectSystem.Particles.Add(p);

            if (audio)
            {
                if (size == 32)
                {
                    PrimalDevistation.Instance.Audio.play("EXPLOSION_LARGE1");
                }
                if (size == 64)
                {
                    PrimalDevistation.Instance.Audio.play("EXPLOSION_LARGE2");
                }
                if (size == 128)
                {
                    PrimalDevistation.Instance.Audio.play("EXPLOSION_LARGE3");
                }
            }
        }
Beispiel #18
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth = MethodBase.GetCurrentMethod();
            string lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (!IsPostBack)
            {
            }

            Classes.cPlayer PlayerInfo = new cPlayer(_UserID, _UserName);
            hidPlayerProfileID.Value = PlayerInfo.PlayerProfileID.ToString();
            gvSkills.DataSource = PlayerInfo.PlayerSkills;
            gvSkills.DataBind();

            gvAffiliations.DataSource = PlayerInfo.PlayerAffiliations;
            gvAffiliations.DataBind();

            tbResumeComments.Text = PlayerInfo.ResumeComments;
            tbLinkedInURL.Text = PlayerInfo.LinkedInURL;
        }
Beispiel #19
0
 public void applyEffect(cPlayer player)
 {
     effect(player);
 }
Beispiel #20
0
 private static void AddAmmo(cPlayer player)
 {
     player.Health += 2;
 }
Beispiel #21
0
        public override void Enter()
        {
            Vector2f worldSize = new Vector2f(m_AppController.MainWindow.Size.X, m_AppController.MainWindow.Size.Y);

            m_View.Size     = new Vector2f(worldSize.X, worldSize.Y);
            m_View.Center   = new Vector2f(worldSize.X / 2.0f, worldSize.Y / 2.0f);
            m_View.Viewport = new FloatRect(0.0f, 0.0f, 1.0f, 1.0f);
            m_View.Zoom(0.6f); //0.6f
            m_AppController.MainWindow.SetView(m_View);

            viewRect = new cAABB();
            viewRect.SetDims(m_View.Size);

            worldEnvironment = new cEnvironment();

            // Constants.LIGHTMAP_COLOR
            lightMap = new cLightSystem(Constants.LIGHTMAP_COLOR); //((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y, Constants.LIGHTMAP_COLOR);
            m_World  = new cWorld(this, m_AppController.MainWindow.Size);

            //lightMap.Create((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y);
            lightMap.Create(m_AppController.MainWindow.Size.X, m_AppController.MainWindow.Size.Y);

            this.staticTexture = new RenderTexture((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y);
            this.staticTexture.SetActive(true);
            this.staticTexture.Clear(new Color(0, 0, 0, 0));
            //this.staticTexture.SetView(m_View);


            Vector2f playerStart = new Vector2f(m_World.LevelStartRegion.center.X, m_World.LevelStartRegion.rightBottom.Y);

            playerStart.X -= Constants.CHAR_FRAME_WIDTH / 2.0f;
            playerStart.Y -= Constants.CHAR_FRAME_HEIGHT;

            m_Player = new cPlayer(this, playerStart);

            entityPool = new cEntityPool(this, m_World.WorldBounds.dims, m_Player);

            //vizekhez adunk fényt
            List <cWaterBlock> waterBlocks = m_World.GetWaterBlocks();

            foreach (cWaterBlock wb in waterBlocks)
            {
                cLight waterLight = new cLight(); //víz blokkokhoz adunk fényt, mert jól néz ki
                waterLight.Pos             = new Vector2f(wb.Area.center.X, wb.Area.topLeft.Y + Constants.TILE_SIZE / 2.0f);
                waterLight.Radius          = (wb.Area.dims.X + wb.Area.dims.Y) * 0.8f;
                waterLight.Bleed           = 0.00001f;                // 0.00001f;
                waterLight.LinearizeFactor = 0.95f;
                waterLight.Color           = new Color(41, 174, 232); // 96,156,164
                lightMap.AddStaticLight(waterLight);
            }

            //háttér, környezeti tárgyak megjelenítése
            worldEnvironment.SetWaterBlocks(waterBlocks);

            this.particleManager = new cParticleManager(this);
            // lightMap.renderStaticLightsToTexture();

            gameCommands = new Queue <Action>(50);
            //Pálya idő start
            levelTimer.Start();
        }
 private static void AddArmor(cPlayer player)
 {
     player.Health += 1;
 }
Beispiel #23
0
        public override void Enter()
        {
            this.resourceAssets.LoadResources(Constants.FONT_NAMES, Constants.TEXTURES_NAMES, Constants.SOUND_NAMES);
            cAnimationAssets.LoadAnimations(this.resourceAssets);

            BulletBreed.Init(this.resourceAssets);
            PickupEffects.InitPickupEffects(this.resourceAssets);

            camera      = new Camera(new View(new Vector2f(appControllerRef.WindowSize.X / 2.0f, appControllerRef.WindowSize.Y / 2.0f), appControllerRef.WindowSize));
            camera.Zoom = 0.6f; //  0.6f;

            appControllerRef.MainWindow.SetView(camera.View);

            /*
             * Vector2f viewSize = new Vector2f(appController.MainWindow.Size.X, appController.MainWindow.Size.Y);
             *
             * m_View.Size = new Vector2f(viewSize.X, viewSize.Y);
             * m_View.Center = new Vector2f(viewSize.X / 2.0f, viewSize.Y / 2.0f);
             * m_View.Viewport = new FloatRect(0.0f, 0.0f, 1.0f, 1.0f);
             * m_View.Zoom(0.6f); //0.6f
             *
             * viewRect = new AABB();
             * viewRect.SetDims(m_View.Size);
             */

            worldEnvironment = new cEnvironment();

            // Constants.LIGHTMAP_COLOR
            lightMap  = new cLightSystem(Constants.LIGHTMAP_COLOR, this.resourceAssets); //((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y, Constants.LIGHTMAP_COLOR);
            gameWorld = new cWorld(this, appControllerRef.MainWindow.Size);

            gameWorld.InitLevel();

            //lightMap.Create((uint)m_World.WorldBounds.dims.X, (uint)m_World.WorldBounds.dims.Y);
            lightMap.Create(appControllerRef.MainWindow.Size.X, appControllerRef.MainWindow.Size.Y);

            lightMap.loadLightsFromTmxMap(gameWorld.CurrentLevel.GetTmxMap());

            this.staticTexture = new RenderTexture((uint)gameWorld.WorldBounds.dims.X, (uint)gameWorld.WorldBounds.dims.Y);
            this.staticTexture.SetActive(true);
            this.staticTexture.Clear(new Color(0, 0, 0, 0));
            //this.staticTexture.SetView(m_View);


            Vector2f playerStart = new Vector2f(gameWorld.LevelStartRegion.center.X, gameWorld.LevelStartRegion.rightBottom.Y);

            playerStart.X -= Constants.CHAR_FRAME_WIDTH / 2.0f;
            playerStart.Y -= Constants.CHAR_FRAME_HEIGHT;

            player = new cPlayer(this, playerStart);

            entityPool = new GameObjectGrid(this, gameWorld.WorldBounds.dims, player);
            entityPool.InitLevelEntites(World.CurrentLevel);

            //vizekhez adunk fényt

            /*
             * List<cWaterBlock> waterBlocks = m_World.GetWaterBlocks();
             *
             * foreach (cWaterBlock wb in waterBlocks)
             * {
             *  cLight waterLight = new cLight(); //víz blokkokhoz adunk fényt, mert jól néz ki
             *  waterLight.Pos = new Vector2f(wb.Area.center.X, wb.Area.topLeft.Y+Constants.TILE_SIZE/2.0f);
             *  waterLight.Radius = (wb.Area.dims.X + wb.Area.dims.Y) * 0.8f;
             *  waterLight.Bleed = 0.00001f; // 0.00001f;
             *  waterLight.LinearizeFactor = 0.95f;
             *  waterLight.Color = new Color(41,174,232); // 96,156,164
             *  lightMap.AddStaticLight(waterLight);
             * }
             *
             * //háttér, környezeti tárgyak megjelenítése
             * worldEnvironment.SetWaterBlocks(waterBlocks);
             */

            this.particleManager = new cParticleManager(this);
            this.effectSystem    = new EffectSystem();
            // lightMap.renderStaticLightsToTexture();

            gameActions = new Queue <Action>(50);

            Listener.GlobalVolume = 80;
            Listener.Direction    = new Vector3f(1.0f, 0.0f, 0.0f);

            ShakeScreen.Init(camera.ActualPosition);
            //Pálya idő start
            levelTimer.Start();
        }
 private static void AddCoin(cPlayer player)
 {
     player.Scene.Assets.PlaySound("coin_pickup1", 10);
     // TODO: player.Money += 1;
 }
    public void InitDungeon(bool isBoss = false)
    {
        //일반 던전
        //플레이어 초기화
        if (isBoss.Equals(false))
        {
            byte curWeaponId = cUtil._user._playerInfo.curWeaponId;
            byte curClothId  = cUtil._user._playerInfo.curClothId;

            _player = Instantiate(Resources.Load <GameObject>("Prefabs/Skin_cloth/Player_skin_" + curClothId.ToString()));
            _player.transform.SetParent(playerParent.transform);
            _player.transform.localScale    = new Vector3(1, 1, 1);
            _player.transform.localPosition = new Vector3(337, 67, 1);
            _p           = _player.transform.GetChild(0).GetComponent <cPlayer>();
            _p.img_curHp = chg_img_curHp;
            _p.t_hp      = chg_t_hp;
            _p.img_curDp = chg_img_curDp;
            _p.t_dp      = chg_t_dp;
            _p.Init(cUtil._user._playerInfo.nickName,
                    cUtil._user._playerInfo.weapon.damage,
                    250.0f,
                    cUtil._user._playerInfo.weapon.hp,
                    cUtil._user._playerInfo.weapon.hp);
            cUtil._player = _p;

            chg_tileMng.Init();
            _p.tileMng   = chg_tileMng;
            _p.quickSlot = chg_quickSlot;
            chg_quickSlot.Init();
            _p.flagPos = chg_flagPos;
            chg_Flag.Init();
            _p.obj_coolTime = chg_obj_coolTime;
            _p.t_coolTime   = chg_t_coolTime;
            _p.sm           = chg_sm;
            _p.indicator    = chg_indicator;
            _p.ft           = chg_floatingText;
            chg_floatingText.Init();
            _p.useMng            = chg_useMng;
            _p.joystick          = chg_joystick;
            chg_joystick._player = _player.transform;
            chg_joystick.Init();
            _p.dp = chg_dp;
            chg_attack.scr_player = _p;
            chg_attack.Init();
            chg_jump.scr_player = _p;
            chg_dash.scr_player = _p;
            chg_light.HeadLight = _p.lightPos;
            chg_camera._player  = _player;

            //ui 초기화
            b_bag.onClick.AddListener(() => OpenBag());
            for (byte i = 0; i < b_exitBag.Length; i++)
            {
                b_exitBag[i].onClick.AddListener(() => ExitBag());
            }

            b_goHome.onClick.AddListener(() => GoHome());

            SetEnemySpriteOrder();
        }
        //보스전
        else
        {
            byte curWeaponId = cUtil._user._playerInfo.curWeaponId;
            byte curClothId  = cUtil._user._playerInfo.curClothId;

            _player = Instantiate(Resources.Load <GameObject>("Prefabs/Skin_cloth/Player_skin_" + curClothId.ToString()));
            _player.transform.SetParent(playerParent.transform);
            _player.transform.localScale    = new Vector3(1, 1, 1);
            _player.transform.localPosition = new Vector3(337, 67, 1);
            _p           = _player.transform.GetChild(0).GetComponent <cPlayer>();
            _p.img_curHp = chg_img_curHp;
            _p.t_hp      = chg_t_hp;
            _p.img_curDp = chg_img_curDp;
            _p.t_dp      = chg_t_dp;
            _p.Init(cUtil._user._playerInfo.nickName,
                    cUtil._user._playerInfo.weapon.damage,
                    250.0f,
                    cUtil._user._playerInfo.weapon.hp,
                    cUtil._user._playerInfo.weapon.hp);
            cUtil._player = _p;

            chg_tileMng.Init();
            _p.tileMng   = chg_tileMng;
            _p.quickSlot = chg_quickSlot;
            chg_quickSlot.Init();
            _p.obj_coolTime = chg_obj_coolTime;
            _p.t_coolTime   = chg_t_coolTime;
            _p.sm           = chg_sm;
            _p.ft           = chg_floatingText;
            chg_floatingText.Init();
            _p.useMng            = chg_useMng;
            _p.joystick          = chg_joystick;
            chg_joystick._player = _player.transform;
            chg_joystick.Init();
            _p.dp = chg_dp;
            chg_attack.scr_player = _p;
            chg_attack.Init();
            chg_jump.scr_player       = _p;
            chg_dash.scr_player       = _p;
            chg_light.HeadLight       = _p.lightPos;
            chg_camera._player        = _player;
            chg_camera.bossPlayerPosY = 200;

            //씬별로 보스 다르게 초기화해야함
            boss_slime.InitBoss();
            boss_SkeletonMage.InitBoss();
        }

        UpdateValue();
    }
 //형상변환 ui
 public void Init()
 {
     _p = _player.transform.GetChild(0).GetComponent <cPlayer>();
     InitDungeon_skin();
 }
        public void SpawnWeapon(string name, Vector2 where, Vector2 vel, cPlayer owner)
        {
            cWeapon bp = GetWepByName(name);

            SpawnWeapon(bp, where, vel, owner);
        }
Beispiel #28
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            Classes.cPlayer PlayerInfo = new cPlayer(_UserID, _UserName);
            hidPlayerProfileID.Value = PlayerInfo.PlayerProfileID.ToString();

            DataTable dtMedical = cUtilities.CreateDataTable(PlayerInfo.PlayerMedical);

            if (dtMedical.Columns["JavaScriptEdit"] == null)
            {
                dtMedical.Columns.Add("JavaScriptEdit", typeof(string));
            }
            if (dtMedical.Columns["JavaScriptDelete"] == null)
            {
                dtMedical.Columns.Add("JavaScriptDelete", typeof(string));
            }

            foreach (DataRow dRow in dtMedical.Rows)
            {
                DateTime?StartDate;
                DateTime?EndDate;

                DateTime dtTemp;

                if (DateTime.TryParse(dRow["StartDate"].ToString(), out dtTemp))
                {
                    StartDate = dtTemp;
                }
                else
                {
                    StartDate = null;
                }
                if (DateTime.TryParse(dRow["EndDate"].ToString(), out dtTemp))
                {
                    EndDate = dtTemp;
                }
                else
                {
                    EndDate = null;
                }

                dRow["JavaScriptEdit"] = string.Format("openMedical({0}, \"{1}\", \"{2}\", \"{3}\", \"{4}\", \"{5}\", \"{6}\"); return false;",
                                                       dRow["PlayerMedicalID"].ToString(), cUtilities.ReplaceQuotes(dRow["Description"]), cUtilities.ReplaceQuotes(dRow["Medication"]),
                                                       dRow["ShareInfo"].ToString(), dRow["PrintOnCard"].ToString(),
                                                       (StartDate.HasValue ? StartDate.Value.ToShortDateString() : ""),
                                                       (EndDate.HasValue ? EndDate.Value.ToShortDateString() : ""));
                dRow["JavaScriptDelete"] = string.Format("openMedicalDelete({0}, \"{1}\", \"{2}\"); return false;",
                                                         dRow["PlayerMedicalID"].ToString(), cUtilities.ReplaceQuotes(dRow["Description"]), cUtilities.ReplaceQuotes(dRow["Medication"]));
            }

            gvMedical.DataSource = dtMedical;
            gvMedical.DataBind();

            DataTable dtLimitations = cUtilities.CreateDataTable(PlayerInfo.PlayerLimitation);

            if (dtLimitations.Columns["JavaScriptEdit"] == null)
            {
                dtLimitations.Columns.Add("JavaScriptEdit", typeof(string));
            }
            if (dtLimitations.Columns["JavaScriptDelete"] == null)
            {
                dtLimitations.Columns.Add("JavaScriptDelete", typeof(string));
            }

            foreach (DataRow dRow in dtLimitations.Rows)
            {
                DateTime?StartDate;
                DateTime?EndDate;
                DateTime dtTemp;

                if (DateTime.TryParse(dRow["StartDate"].ToString(), out dtTemp))
                {
                    StartDate = dtTemp;
                }
                else
                {
                    StartDate = null;
                }
                if (DateTime.TryParse(dRow["EndDate"].ToString(), out dtTemp))
                {
                    EndDate = dtTemp;
                }
                else
                {
                    EndDate = null;
                }

                dRow["JavaScriptEdit"] = string.Format("openLimitations({0}, \"{1}\", \"{2}\", \"{3}\", \"{4}\", \"{5}\"); return false;",
                                                       dRow["PlayerLimitationID"].ToString(), cUtilities.ReplaceQuotes(dRow["Description"]), dRow["ShareInfo"].ToString(),
                                                       dRow["PrintOnCard"].ToString(),
                                                       (StartDate.HasValue ? StartDate.Value.ToShortDateString() : ""),
                                                       (EndDate.HasValue ? EndDate.Value.ToShortDateString() : ""));
                dRow["JavaScriptDelete"] = string.Format("openLimitationsDelete({0}, \"{1}\"); return false;",
                                                         dRow["PlayerLimitationID"].ToString(), cUtilities.ReplaceQuotes(dRow["Description"]));
            }

            gvLimitations.DataSource = dtLimitations;
            gvLimitations.DataBind();

            tbMedicalComments.Text = PlayerInfo.MedicalComments;
            tbAllergies.Text       = PlayerInfo.Allergies;
        }
Beispiel #29
0
        public static void Main(string[] args)
        {
            //-------------START----------------//
            int objSize = 9;             //manual set TODO change to objArray.Count;
            //Random rnd = new Random();
            List <Weapon> weaponData = new List <Weapon>();

            weaponData.Add(new Weapon("hands", 1, 2));
            weaponData.Add(new Weapon("keyboard", 2, 4));
            weaponData.Add(new Weapon("spoon", 1, 3));
            weaponData.Add(new Weapon("vape", 2, 2));

            List <Item> itemData = new List <Item>();

            itemData.Add(new Item("hands", "wep", false, "These are hands"));
            itemData.Add(new Item("keyboard", "wep", false, "The keyboard has j**z in it"));
            itemData.Add(new Item("spoon", "wep", false, "Just a silver spoon"));
            itemData.Add(new Item("vape", "wep", false, "Mad vape brahh"));
            itemData.Add(new Item("Paper", "itm", true, "Just blank paper"));
            itemData.Add(new Item("Feather", "itm", true, "Feather from some dead bird"));

            List <objectParent> objArray = new List <objectParent>();
            //objectBen objBen = new objectBen();
            objectSam objSam = new objectSam();

            objArray.Add(new objectBen(weaponData[1].name));            //spoon
            objArray.Add(objSam);
            objArray.Add(new objDoor(6, 1, 2, 1, 1, 3));
            objArray.Add(new objDoor(0, 1, 3, 5, 1, 2));
            objArray.Add(new objDoor(4, 3, 3, 7, 4, 4));
            objArray.Add(new objDoor(5, 3, 3, 7, 4, 4));
            objArray.Add(new objDoor(7, 3, 4, 5, 3, 2));
            objArray.Add(new InventoryContainer("Inventory", 10, 0, 0, 0));
            objArray.Add(new InventoryContainer("testInv", 5, 1, 3, 3));


            cPlayer Player = new cPlayer("Merle");             //creates player

            for (int x = 0; x < stageDone.Length; x++)         //set stages to false
            {
                stageDone[x] = false;
            }
            ;
            int    tempInt    = 0;
            string tempString = "0";
            bool   tempBool   = false;



            //Load in map files to Maps[][,] array
            void loadInMaps()
            {
                string location = "/home/pc/CS/MerleProject/MerlesAdventure/Maps";

                //location = Console.ReadLine();
                for (int x = 0; x <= manyMaps - 1; x++)
                {
                    string loc          = location + "/Map" + System.Convert.ToString(x);
                    string fileContents = System.IO.File.ReadAllText(loc);
                    fileContents = fileContents.Replace(System.Environment.NewLine, "");             //removes NL

                    mapSizes [x, 0] = System.Convert.ToInt32(fileContents.Substring(0, 2));          //places in the x
                    mapSizes [x, 1] = System.Convert.ToInt32(fileContents.Substring(2, 2));          //places in the y

                    Maps[x] = new string[mapSizes[x, 0], mapSizes[x, 1]];                            //initialze map (sets the array size)
                    int tempPosCounter = 4;
                    for (int y = 0; y < mapSizes[x, 1]; y++)                                         //y
                    {
                        for (int j = 0; j < mapSizes[x, 0]; j++)                                     //x
                        {
                            Maps[x][j, y]   = System.Convert.ToString(fileContents[tempPosCounter]); //places char into map
                            tempPosCounter += 1;
                        }
                        //next loop
                    }
                }
            }

            //Display Map
            void displayMap(int x)
            {
                Console.Clear();
                for (int y = 0; y < mapSizes[x, 1]; y++)            //y
                {
                    for (int j = 0; j < mapSizes[x, 0]; j++)        //x
                    {
                        Console.Write(Maps[x][j, y]);

                        /*if ((y == 0) && (j == (mapSizes[x,0]) - 1)){
                         *      Console.Write(" [{0},{1}]", Player.playerx,Player.playery);
                         * }*/
                    }
                    Console.WriteLine("");
                }
                //health
                Console.SetCursorPosition(mapSizes[x, 0], 0);
                Console.Write(" Hth:[{0}/{1}]", Player.health, Player.mhealth);
                //level
                Console.SetCursorPosition(mapSizes[x, 0], 1);
                Console.Write(" Lvl:{0}[0/5]", Player.level);
                //attack
                Console.SetCursorPosition(mapSizes[x, 0], 2);
                var wepTmp = weaponData.First(item => item.name == Player.weapon);

                Console.Write(" Atk:{0}+[{1}-{2}]", Player.attack, wepTmp.minDmg, wepTmp.maxDmg);              //TODO
                //defence
                Console.SetCursorPosition(mapSizes[x, 0], 3);
                Console.Write(" Def:{0}", Player.defence);
                //speed
                Console.SetCursorPosition(mapSizes[x, 0], 4);
                Console.Write(" Spd:{0}", Player.speed);
                //weapon
                Console.SetCursorPosition(mapSizes[x, 0], 5);
                Console.Write(" Wep:[{0}]", Player.weapon);
                //x,y
                Console.SetCursorPosition(mapSizes[x, 0], 6);
                Console.Write(" Pos:[{0},{1}]", Player.playerx, Player.playery);
                //set x,y under map
                Console.SetCursorPosition(0, mapSizes[x, 1]);
            }

            void envInteract(int xx, int yy)              // doesnt check for current map
            {
                for (int j = 0; j < objSize; j++)
                {
                    if (objArray[j].map == currentMap)
                    {
                        if ((Player.playerx + xx == objArray[j].x) && (Player.playery + yy == objArray[j].y))                          //check player x + direction = objects y

                        {
                            if (objArray[j].type == "char")
                            {
                                objArray[j].Talk();
                                if (objArray[j].battle == true)
                                {
                                    Battle(j);
                                    displayMap(currentMap);
                                }
                            }
                            else if (objArray[j].type == "door")
                            {
                                objArray[j].Enter(Player);
                                displayMap(currentMap);
                            }
                            else if (objArray[j].type == "cont")
                            {
                                ContainerUI(j);
                            }
                        }
                    }
                }
            }

            void ckLevelUp()              //TODO
            {
            }

            void Battle(int j)
            {
                objectParent other     = objArray[j];
                int          disy      = 7;
                bool         canAttack = false;

                Console.Clear();
                objectParent[] Person = new objectParent[2] {
                    Player, other
                };

                void clearMid(int iFrom, int iTo)
                {
                    for (int n = iFrom; n <= iTo; n++)
                    {
                        Console.SetCursorPosition(0, n);
                        for (int i = 0; i < Console.WindowWidth; i++)
                        {
                            Console.Write(" ");
                        }
                    }
                }

                void HealthBar(int xx, int yy, bool bPlayer)
                {
                    //Console.WriteLine(Person[0].name); remove
                    if (bPlayer == true)
                    {
                        tempInt = (Person[0].health * 10) / Person[0].mhealth;                      //never let the number become decimal
                    }
                    else
                    {
                        tempInt = (other.health * 10) / other.mhealth;
                    }
                    Console.SetCursorPosition(xx, yy);
                    Console.Write("[");
                    for (int i = 0; i < tempInt; i++)
                    {
                        Console.Write("#");                        //HealthBar!!
                    }
                    for (int i = 0; i < 10 - tempInt; i++)
                    {
                        Console.Write("-");
                    }
                    Console.Write("]");
                    Console.SetCursorPosition(xx, yy + 1);
                }

                void draw()
                {
                    int drwx = 13;

                    clearMid(0, disy - 1);
                    tempInt = (Player.health * 10) / Player.mhealth;                  //never let the number become decimal
                    var wepTmp = weaponData.First(item => item.name == Person[0].weapon);

                    Console.SetCursorPosition(0, 0);
                    Console.WriteLine("[{0}]", Player.name);
                    HealthBar(0, 1, true);
                    Console.WriteLine("Hth:{0}/{1}", Player.health, Player.mhealth);
                    Console.WriteLine("Wep:{0}", Player.weapon);
                    Console.WriteLine("Atk:{0}+[{1}-{2}]", Player.attack, wepTmp.minDmg, wepTmp.maxDmg);
                    Console.WriteLine("Def:{0}", Person[0].defence);
                    Console.WriteLine("Spd:{0}", Person[0].speed);


                    Console.SetCursorPosition(13, 0);                    //enemy draw
                    wepTmp = weaponData.First(item => item.name == Person[1].weapon);
                    Console.Write("| [{0}]", Person[1].name);
                    HealthBar(13, 1, false);
                    Console.SetCursorPosition(13, 2);
                    Console.WriteLine("| Hth:{0}/{1}", Person[1].health, Person[1].mhealth);
                    Console.SetCursorPosition(13, 3);
                    Console.WriteLine("| Wep:{0}", Person[1].weapon);
                    Console.SetCursorPosition(13, 4);
                    Console.WriteLine("| Atk:{0}+[{1}-{2}]", Person[1].attack, wepTmp.minDmg, wepTmp.maxDmg);
                    Console.SetCursorPosition(drwx, 5);
                    Console.WriteLine("| Def:{0}", Person[1].defence);
                    Console.SetCursorPosition(drwx, 6);
                    Console.WriteLine("| Spd:{0}", Person[1].speed);
                }

                void atkRound()
                {
                    void personAttack(int l, int t)                     //0 for player 1 for other, t for disy placement
                    {
                        if (rnd.Next(0, 100) > 79)
                        {
                            canAttack = true;
                        }

                        if (canAttack == true)
                        {
                            int wepDm       = weaponData.First(item => item.name == Person[l].weapon).Damage();
                            int totalDamage = Person[0 + l].attack + wepDm - Person[1 - l].defence; //damage equasion
                            if (totalDamage >= 0)                                                   //untested Done
                            {
                                Person[1 - l].health -= totalDamage;                                //TODO if defence is high enough, damage adds health
                            }
                            draw();
                            Console.SetCursorPosition(0, disy + 1 + t);
                            Console.WriteLine("[{0}]Hit {1} with [{2}] for {3} damage",
                                              Person[l].name, Person[1 - l].name, Person[l].weapon, totalDamage);
                        }
                        else
                        {
                            Console.SetCursorPosition(0, disy + 1 + t);
                            Console.WriteLine("[{0}]Missed!", Person[l].name);
                        }
                    }

                    //check if Players is dead
                    bool ckIfDead()
                    {
                        Console.SetCursorPosition(0, disy + 3);
                        if (Person[0].health <= 0)
                        {
                            Console.WriteLine("You Died!");                   //---Player dies---
                            other.battle = false;                             //TODO remove this
                            Console.SetCursorPosition(0, disy + 7);
                            return(true);
                        }
                        else if (Person[1].health <= 0)
                        {
                            Console.WriteLine("You killed Him/Her!");                             // other dies
                            other.battle = false;
                            Maps[currentMap][other.x, other.y] = ".";
                            other.x = 0;
                            other.y = 0;
                            Console.SetCursorPosition(0, disy + 7);
                            Console.Write("Press any ENTER to continue..");
                            Console.Read();
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }

                    //Determine who attacks first
                    int firstToAtk;

                    if (Player.speed >= other.speed)
                    {
                        firstToAtk = 0;
                    }
                    else
                    {
                        firstToAtk = 1;
                    }

                    personAttack(0 + firstToAtk, 0);           // person, disy placement
                    tempBool = ckIfDead();                     //checks if person killed other, if not then runs method for other person to hit
                    if (!tempBool)
                    {
                        personAttack(1 - firstToAtk, 1);
                        ckIfDead();
                    }
                }

                void usrInput()
                {
                    Console.SetCursorPosition(0, disy + 4);
                    Console.WriteLine("[0]Attack");
                    Console.WriteLine("[1]Block");                     //TODO
                    Console.WriteLine("[2]Potion");                    //TODO
                    Console.Write("> ");
                    string input = Console.ReadLine();

                    clearMid(disy, disy + 3);                  //battle narration
                    clearMid(disy + 7, disy + 7);              //command line
                    switch (input)
                    {
                    case "0":
                    {
                        atkRound();
                        break;
                    }

                    case "1":
                    {
                        break;
                    }

                    default:
                    {
                        Console.WriteLine("Unknown Command");
                        break;
                    }
                    }
                }

                while (other.battle)
                {
                    draw();
                    usrInput();
                }
            }

            void ContainerItemAdd(int C, string itemNm, int amt = 1)
            {
                //C = container, itemNm reference item database, amt = quantity
                for (int i = 0; i < objArray[C].size; i++)
                {
                    if ((objArray[C].slot[i].name == itemNm) &&
                        (objArray[C].slot[i].stackable == true))                    //if you already have the item

                    {
                        objArray[C].slot[i].quantity += amt;
                        break;
                    }
                    else if (objArray[C].slot[i].name == "")
                    {
                        int itemId = itemData.FindIndex(item => item.name == itemNm);

                        objArray[C].slot[i].name        = itemData[itemId].name;
                        objArray[C].slot[i].type        = itemData[itemId].type;
                        objArray[C].slot[i].stackable   = itemData[itemId].stackable;
                        objArray[C].slot[i].quantity    = amt;
                        objArray[C].slot[i].description = itemData[itemId].description;

                        break;
                    }
                }
            }

            void ContainerItemDestroy(int C, int ind)
            {
                //C = container (666 for player),ind = index of container
                objArray[C].slot[ind].name        = "";
                objArray[C].slot[ind].type        = "";
                objArray[C].slot[ind].stackable   = false;
                objArray[C].slot[ind].quantity    = 0;
                objArray[C].slot[ind].description = "";
            }

            void ContainerDisplay(int C)
            {
                //C = container
                //Console.Clear();
                for (int i = 0; i < objArray[C].size; i++)
                {
                    Console.Write("[{0}] {1}", i + 1, objArray[C].slot[i].name);

                    if (objArray[C].slot[i].stackable == true)
                    {
                        Console.Write(" ({0})", objArray[C].slot[i].quantity);
                    }
                    Console.WriteLine("");
                }
            }

            void ContainerSort(int C)
            {
                //C = container
                void Swap(int fst, int snd)
                {
                    //name
                    tempString = objArray[C].slot[fst].name;
                    objArray[C].slot[fst].name = objArray[C].slot[snd].name;
                    objArray[C].slot[snd].name = tempString;
                    //type
                    tempString = objArray[C].slot[fst].type;
                    objArray[C].slot[fst].type = objArray[C].slot[snd].type;
                    objArray[C].slot[snd].type = tempString;
                    //stackable
                    tempBool = objArray[C].slot[fst].stackable;
                    objArray[C].slot[fst].stackable = objArray[C].slot[snd].stackable;
                    objArray[C].slot[snd].stackable = tempBool;
                    //quantity
                    tempInt = objArray[C].slot[fst].quantity;
                    objArray[C].slot[fst].quantity = objArray[C].slot[snd].quantity;
                    objArray[C].slot[snd].quantity = tempInt;
                    //description
                    tempString = objArray[C].slot[fst].description;
                    objArray[C].slot[fst].description = objArray[C].slot[snd].description;
                    objArray[C].slot[snd].description = tempString;
                }

                for (int j = 0; j < objArray[C].size; j++)
                {
                    for (int i = 0; i < objArray[C].size - 1; i++)
                    {
                        if (objArray[C].slot[i].name == "")
                        {
                            Swap(i, i + 1);
                        }
                    }
                }
            }

            void ContainerItemTransfer(bool T, int C, int fromInd)
            {
                //T = true if from player inv to container, C = container, fromInd = index
                int otherC;

                if (T == true)                   //orentates which C is main and which is other
                {
                    otherC = C;
                    C      = objArray.FindIndex(item => item.name == "Inventory");
                }
                else
                {
                    otherC = objArray.FindIndex(item => item.name == "Inventory");
                }

                if ((fromInd >= 0) &&
                    (fromInd < objArray[C].size) &&
                    (objArray[C].slot[fromInd].name != ""))                      //removes user error and cant transfer nothing
                {
                    for (int i = 0; i < objArray[otherC].size; i++)              //search through each slot for free space
                    {
                        if (objArray[otherC].slot[i].name == "")                 //if its free
                        {
                            string itemNm  = objArray[C].slot[fromInd].name;     //name and quantity needed for
                            int    itemAmt = objArray[C].slot[fromInd].quantity; //item add
                            ContainerItemAdd(otherC, itemNm, itemAmt);           //adds item to container
                            ContainerItemDestroy(C, fromInd);                    //removes item form org cont
                            ContainerSort(C);                                    //sorts cont after item removed
                            break;
                        }
                    }
                }
            }

            string ContainerItemInspect(int C, int ind)
            {
                if ((ind >= 0) && (ind < objArray[C].size))
                {
                    Console.WriteLine("[{0}] {1}", objArray[C].slot[ind].name, objArray[C].slot[ind].description);
                    return(objArray[C].slot[ind].description);
                }
                else
                {
                    return("");
                }
            }

            void ItemSwitch()
            {
            }

            void ItemEquipt(string wep, int ind)
            {
                tempInt = itemData.FindIndex(item => item.name == wep);                 //finds item index of weapon
                if ((ind >= 0) && (tempInt >= 0) && (itemData[tempInt].type == "wep"))
                {
                    int userInvInd = objArray.FindIndex(item => item.name == "Inventory");
                    //store user weapon name temp
                    tempString = Player.weapon;
                    //equipt item
                    Player.weapon = wep;
                    //destroy inventory slot
                    ContainerItemDestroy(userInvInd, ind);
                    //add item of weapon temp
                    ContainerItemAdd(userInvInd, tempString);
                }
            }

            void InventoryUI()
            {
                bool done       = false;
                int  userInvInd = objArray.FindIndex(item => item.name == "Inventory");

                void Draw()
                {
                    Console.WriteLine(objArray[userInvInd].name);
                    ContainerDisplay(userInvInd);
                    Console.WriteLine("");
                }

                void usrInput()
                {
//					Console.WriteLine("");
//					Console.WriteLine("");
//					Console.WriteLine("");
                    Console.WriteLine("[0]Inspect");
                    Console.WriteLine("[1]Equipt");
                    Console.WriteLine("[2]Destroy");
                    Console.WriteLine("[3]Leave");
                    Console.Write("> ");
                    string input = Console.ReadLine();

                    switch (input)
                    {
                    case "0":
                    {
                        Console.Write("slot> ");
                        string tempInput = Console.ReadLine();
                        tempBool = Int32.TryParse(tempInput, out tempInt);
                        if (tempBool == true)
                        {
                            tempInt -= 1;
//								Console.SetCursorPosition(0,12);
                            ContainerItemInspect(userInvInd, tempInt);
//								Console.SetCursorPosition(0,16);
                            Console.ReadLine();
                        }
                        break;
                    }

                    case "1":
                    {
                        Console.Write("slot> ");
                        string tempInput = Console.ReadLine();
                        tempBool = Int32.TryParse(tempInput, out tempInt);
                        if (tempBool == true)
                        {
                            tempInt   -= 1;
                            tempString = objArray[userInvInd].slot[tempInt].name;
                            ItemEquipt(tempString, tempInt);
                        }
                        break;
                    }

                    case "2":
                    {
                        Console.Write("slot> ");
                        string tempInput = Console.ReadLine();
                        tempBool = Int32.TryParse(tempInput, out tempInt);
                        if (tempBool == true)
                        {
                            tempInt -= 1;
                            ContainerItemDestroy(userInvInd, tempInt);
                        }
                        break;
                    }

                    case "3":
                    {
                        done = true;
                        Console.Clear();
                        displayMap(currentMap);
                        break;
                    }

                    default:
                    {
                        Console.WriteLine("Unknown Command");
                        break;
                    }
                    }
                }

                while (!done)
                {
                    Console.Clear();
                    Draw();
                    usrInput();
                }
            }

            void ContainerUI(int Cont)
            {
                bool done       = false;
                int  userInvInd = objArray.FindIndex(item => item.name == "Inventory");

                void Draw()
                {
                    Console.WriteLine(objArray[Cont].name);
                    ContainerDisplay(Cont);
                    Console.WriteLine("");

                    Console.WriteLine(objArray[userInvInd].name);
                    ContainerDisplay(userInvInd);
                    Console.WriteLine("");
                }

                void usrInput()
                {
                    Console.WriteLine("[0]Take");
                    Console.WriteLine("[1]Put In");
                    Console.WriteLine("[2]Destroy");
                    Console.WriteLine("[3]Leave");
                    Console.WriteLine("[4]Switch (?)");
                    Console.Write("> ");
                    string input = Console.ReadLine();

                    switch (input)
                    {
                    case "0":
                    {
                        Console.Write("slot> ");
                        string tempInput = Console.ReadLine();
                        tempBool = Int32.TryParse(tempInput, out tempInt);
                        if (tempBool == true)
                        {
                            tempInt -= 1;
                            ContainerItemTransfer(false, Cont, tempInt);
                        }
                        break;
                    }

                    case "1":
                    {
                        Console.Write("slot> ");
                        string tempInput = Console.ReadLine();
                        tempBool = Int32.TryParse(tempInput, out tempInt);
                        if (tempBool == true)
                        {
                            tempInt -= 1;
                            ContainerItemTransfer(true, Cont, tempInt);
                        }
                        break;
                    }

                    case "2":
                    {
                        Console.Write("slot> ");
                        string tempInput = Console.ReadLine();
                        tempBool = Int32.TryParse(tempInput, out tempInt);
                        tempInt -= 1;
                        if (tempBool == true)
                        {
                            ContainerItemDestroy(Cont, tempInt);
                        }
                        break;
                    }

                    case "3":
                    {
                        done = true;
                        Console.Clear();
                        displayMap(currentMap);
                        break;
                    }

                    default:
                    {
                        Console.WriteLine("Unknown Command");
                        break;
                    }
                    }
                }

                while (!done)
                {
                    Console.Clear();
                    Draw();
                    usrInput();
                }
            }

            void TestRoom()
            {
                Console.Clear();
                //				InventoryContainer testInv = new InventoryContainer("testInv",5,0,0,0);
                //				testInv.slot[0].name = "Paper";

                int tempInt9 = objArray.FindIndex(item => item.name == "testInv");
                int tempInt7 = objArray.FindIndex(item => item.name == "Inventory");

                ContainerItemAdd(tempInt9, "vape");
                ContainerItemAdd(tempInt9, "hands");
                ContainerItemAdd(tempInt9, "Paper", 4);
                ContainerItemAdd(tempInt9, "Feather", 3);
                ContainerItemAdd(tempInt9, "Feather", 4);
                ContainerItemAdd(tempInt7, "Feather", 3);
                ContainerItemAdd(tempInt9, "spoon");
                ContainerItemDestroy(tempInt9, 0);
                ContainerSort(tempInt9);
                ContainerDisplay(tempInt9);
                ContainerItemInspect(tempInt9, 0);
                Console.WriteLine(objArray[tempInt9].slot[0].description);
            }

            void userInput()              //TODO fix bug for if input less then .length of 2
            {
                Console.WriteLine("");
                Console.Write("> ");
                string input = Console.ReadLine();

                input.ToLower();                 //formats input
                Console.WriteLine(input.Length);

                switch (input)
                {
                case "show letter":
                case "display letter":
                {
                    Player.OpenLetter();
                    break;
                }

                case "   ":
                {
                    TestRoom();
                    break;
                }

                case "restore health":
                {
                    Player.health = Player.mhealth;
                    break;
                }

                case "interact left":
                case "il":
                {
                    envInteract(-1, 0);
                    break;
                }

                case "interact right":
                case "ir":
                {
                    envInteract(1, 0);
                    break;
                }

                case "interact up":
                case "iu":
                {
                    envInteract(0, -1);
                    break;
                }

                case "interact down":
                case "id":
                {
                    envInteract(0, 1);
                    break;
                }

                case "move up":
                case "mu":
                {
                    Player.moveUp();
                    displayMap(currentMap);
                    break;
                }

                case "move down":
                case "md":
                {
                    Player.moveDown();
                    displayMap(currentMap);
                    break;
                }

                case "move left":
                case "ml":
                {
                    Player.moveLeft();
                    displayMap(currentMap);
                    break;
                }

                case "move right":
                case "mr":
                {
                    Player.moveRight();
                    displayMap(currentMap);
                    break;
                }

                case "show map":
                case "display map":
                case "map":

                {
                    displayMap(currentMap);
                    break;
                }

                case "show inventory":
                case "display inventory":
                case "inventory":
                {
                    InventoryUI();
                    break;
                }

                case "":                 //change
                {
                    displayMap(currentMap);
                    break;
                }

                default:
                {
                    if ((input.Length > 4) && (input.Substring(0, 3) == "map"))                              //show different maps
                    {
                        if (Convert.ToInt32(input.Substring(4)) < manyMaps)
                        {
                            displayMap(Convert.ToInt32(input.Substring(4)));
                        }
                        else
                        {
                            Console.WriteLine("That map doesnt exist");
                        }
                    }
                    else if ((input.Length > 3) &&                          //TODO seperate input.length and if true run other code
                             (input.Substring(0, 2) == "ml") ||                           //check if substrings equal any of the commands
                             (input.Substring(0, 2) == "mr") ||                           //then remove user error by testing if theres a number
                             (input.Substring(0, 2) == "mu") ||                           //by trying to convert last char/s to int
                             (input.Substring(0, 2) == "md") //then runs the command if theyre equal to any command
                             )                               //move left
                    {
                        tempBool = Int32.TryParse(input.Substring(3), out tempInt);
                        if (tempBool == true)
                        {
                            for (int x = 0; x < Convert.ToInt32(input.Substring(3)); x++)
                            {
                                if (input.Substring(0, 2) == "ml")
                                {
                                    Player.moveLeft();
                                }
                                else if ((input.Substring(0, 2) == "mr"))
                                {
                                    Player.moveRight();
                                }
                                else if ((input.Substring(0, 2) == "mu"))
                                {
                                    Player.moveUp();
                                }
                                else if ((input.Substring(0, 2) == "md"))
                                {
                                    Player.moveDown();
                                }
                                else
                                {
                                    Console.WriteLine("Error input.substring if statement");
                                }
                            }
                            displayMap(currentMap);
                        }
                    }
                    else if (input == "help")
                    {
                        //help method
                    }
                    else
                    {
                        Console.WriteLine("Unknown command");
                    }

                    break;
                }
                }
            }

            //--------------------------------------------------------------------//
            loadInMaps();
            Console.WriteLine("Welcome");

            while (true)
            {
                userInput();
            }

            while (stageDone[0] == false)
            {
                //code for stage 0 of the game
            }
            ;


            /*C  onsole.WriteLine ("Merle Is Awesome!");
             * Console.SetCursorPosition (4, 0);
             * System.Threading.Thread.Sleep(2000);
             * Console.Write ("Y");
             */
        }
Beispiel #30
0
 public virtual void Enter(cPlayer p)
 {
 }