예제 #1
0
        public void SwitchState(HumanControllerState newState)
        {
            if (State == HumanControllerState.FREE)
            {
                if (newState == HumanControllerState.CREATOR_STATS)
                {
                    HUDNewCharacterStats.IsVisible = true;
                    HUDNewCharacterStats.KwadratyLosu[0].Zaznaczony = true;
                    HUDNewCharacterStats.KtoryZaznaczony = 0;
                }
                if (newState == HumanControllerState.STATS)
                {
                    HUDStats.IsVisible = true;
                    Character.MoveLeftOrder = false;
                    Character.MoveRightOrder = false;
                    Character.MoveOrder = false;
                    Character.MoveOrderBack = false;
                    StatisticsB4 = Character.Statistics.statistics_Clone();
                    ExpB4 = Character.Profile.Exp;
                }
                if (newState == HumanControllerState.MENU)
                    HUDMenu.IsVisible = true;
                if (newState == HumanControllerState.TALK)
                    SwitchTalkState(HumanTalkState.LISTENING);
                if (newState == HumanControllerState.INVENTORY)
                    HUDInventory.IsVisible = true;
                if (newState == HumanControllerState.CONTAINER)
                {

                    HUDContainer.IsVisible = true;
                    if (HUDContainer.Container.Contains.Count > 0)
                    {
                        HUDContainer.ActiveEq = 1;
                        HUDContainer.SelectIndex2 = 0;
                        HUDContainer.SelectIndex1 = -1;
                    }
                    else
                    {
                        HUDContainer.ActiveEq = 0;
                        HUDContainer.SelectIndex1 = 0;
                        HUDContainer.SelectIndex2 = -1;
                    }

                    HUDContainer.UpdateViewAll();

                }

                if (newState == HumanControllerState.SHOP)
                {
                    HUDShop.IsVisible = true;
                }

                if (newState == HumanControllerState.CONSOLE)
                {
                    Engine.Singleton.IngameConsole.Visible = true;
                }
            }
            else if (State == HumanControllerState.TALK)
            {
                if (newState == HumanControllerState.FREE)
                {
                    HideTalkOverlay();
                    Engine.Singleton.IsKeyTyped(MOIS.KeyCode.KC_SPACE);

                    if ((FocusObject as Character).Activities.Paused)
                    {
                        (FocusObject as Character).Activities.Paused = false;
                    }

                }
            }
            else if (State == HumanControllerState.CONTAINER)
            {
                if (newState == HumanControllerState.FREE)
                {

                    HUDContainer.IsVisible = false;

                }
            }

            else if (State == HumanControllerState.INVENTORY)
            {
                if (newState == HumanControllerState.FREE)
                    HUDInventory.IsVisible = false;
            }
            else if (State == HumanControllerState.SHOP)
            {
                if (newState == HumanControllerState.FREE)
                    HUDShop.IsVisible = false;
            }

            else if (State == HumanControllerState.MENU)
                HUDMenu.IsVisible = false;

            else if (State == HumanControllerState.STATS)
            {
                HUDStats.IsVisible = false;
                Character.Profile.Exp = ExpB4;
                Character.Statistics = StatisticsB4.statistics_Clone();
            }

            else if (State == HumanControllerState.CREATOR_STATS)
            {
                HUDNewCharacterStats.IsVisible = false;
            }
            else if (State == HumanControllerState.CONSOLE)
            {
                if (newState == HumanControllerState.FREE)
                    Engine.Singleton.IngameConsole.Visible = false;
            }

            State = newState;
        }
예제 #2
0
        public Enemy(CharacterProfile profile, bool czyPojemnik, float zasiegWzr, float zasiegOgl)
        {
            Profile = profile.Clone();

            _Orientation = Quaternion.IDENTITY;

            Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
            Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
            Node.AttachObject(Entity);

            Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor;

            ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
                Node,
                Quaternion.IDENTITY,
                0.1f,
                Engine.Singleton.GetUniqueBodyId());

            Vector3 inertia, offset;
            collision.CalculateInertialMatrix(out inertia, out offset);

            inertia *= Profile.BodyMass;

            Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
            Body.AttachNode(Node);
            Body.SetMassMatrix(Profile.BodyMass, inertia);
            Body.AutoSleep = false;

            Body.Transformed += BodyTransformCallback;
            Body.ForceCallback += BodyForceCallback;

            Body.UserData = this;
            Body.MaterialGroupID = Engine.Singleton.MaterialManager.EnemyMaterialID;

            Joint upVector = new MogreNewt.BasicJoints.UpVector(
            Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y);

            collision.Dispose();

            isContainer = czyPojemnik;
            isSeen = false;
            isReachable = false;
            _ZasiegWzroku = zasiegWzr;
            _ZasiegOgolny = zasiegOgl;
            _Statistics = Profile.Statistics.statistics_Clone();
            State = StateTypes.IDLE;

            //DROPPRIZE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

            if (Profile.DropPrizeID == "")
                Profile.DropPrizeID = "pPusty";

            DropPrize = PrizeManager.P[Profile.DropPrizeID].prize_Clone();
            List<DescribedProfile> lista_tym = new List<DescribedProfile>();
            List<DescribedProfile> lista_tym2 = new List<DescribedProfile>(DropPrize.ItemsList);

            if (DropPrize.ItemsList.Count > 2)
            {
                for (int i = 0; i < 2; i++)
                {
                    int Los = Engine.Singleton.Random.Next(lista_tym2.Count);
                    lista_tym.Add(lista_tym2[Los]);
                    lista_tym2.RemoveAt(Los);
                    DropPrize.ItemsList = new List<DescribedProfile>(lista_tym);
                }
            }

            else
                DropPrize.ItemsList = new List<DescribedProfile>(DropPrize.ItemsList);

            DropPrize.AmountGold = Engine.Singleton.Random.Next(DropPrize.AmountGold / 2, DropPrize.AmountGold + 1);
            DropExp = DropPrize.AmountExp;

            //PO DROPPRIZIE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

            walkAnim = Entity.GetAnimationState("WALK");
            idleAnim = Entity.GetAnimationState("IDLE");
            attackAnim = Entity.GetAnimationState("ATTACK");
            deadAnim = Entity.GetAnimationState("DEAD");

            //Animation("IdleLegs").Enabled = true;
            //Animation("IdleLegs").Loop = true;
            FriendlyType = Profile.FriendlyType;
            ProfName = Profile.ProfileName;
        }
예제 #3
0
        private void HandleStats()
        {
            HUDStats.Update();

            bool kibel = false;

            for (int i = 0; i < 7; i++)
            {
                if (HUDStats.Stats[i].AddAble && HUDStats.Stats[i].IsOverAddPoint())
                {
                    if (!HUDStats.Stats[i].AddPoint_Available)
                    {
                        String Req = "Wymagane ";
                        switch (i)
                        {
                            case 0:
                                Req += (Character.Statistics.Ile_WW + 1) * 100;
                                break;
                            case 1:
                                Req += (Character.Statistics.Ile_KR + 1) * 100;
                                break;
                            case 2:
                                Req += (Character.Statistics.Ile_ZR + 1) * 100;
                                break;
                            case 3:
                                Req += (Character.Statistics.Ile_ZY + 1) * 100;
                                break;
                            case 4:
                                Req += (Character.Statistics.Ile_CH + 1) * 100;
                                break;
                            case 5:
                                Req += (Character.Statistics.Ile_OP + 1) * 100;
                                break;
                            case 6:
                                Req += (Character.Statistics.Ile_ODP + 1) * 100;
                                break;
                        }

                        Req += " PD";
                        kibel = true;
                        HUDStats.Required.IsVisible = true;
                        HUDStats.RequiredBg.IsVisible = true;
                        HUDStats.Required.Caption = Req;
                    }
                }
            }

            if (!kibel)
            {
                HUDStats.Required.IsVisible = false;
                HUDStats.RequiredBg.IsVisible = false;
            }

            if (Engine.Singleton.Mysza && Engine.Singleton.Przycisk == MOIS.MouseButtonID.MB_Left)
            {
                Engine.Singleton.Mysza = false;

                for (int i = 0; i < 7; i++)
                {
                    if (HUDStats.Stats[i].AddAble && HUDStats.Stats[i].IsOverAddPoint())
                    {
                        if (HUDStats.Stats[i].AddPoint_Available)
                        {
                            switch (i)
                            {
                                case 0:
                                    Character.Statistics.Ile_WW++;
                                    Character.Statistics.WalkaWrecz += 5;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_WW) * 100;
                                    break;

                                case 1:
                                    Character.Statistics.Ile_KR++;
                                    Character.Statistics.Krzepa += 5;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_KR) * 100;
                                    Character.Statistics.Sila = Character.Statistics.Krzepa / 10;
                                    break;

                                case 2:
                                    Character.Statistics.Ile_ZR++;
                                    Character.Statistics.Zrecznosc += 5;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_ZR) * 100;
                                    break;

                                case 3:
                                    Character.Statistics.Ile_ZY++;
                                    Character.Statistics.Zywotnosc += 1;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_ZY) * 100;
                                    break;

                                case 4:
                                    Character.Statistics.Ile_CH++;
                                    Character.Statistics.Charyzma += 5;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_CH) * 100;
                                    break;

                                case 5:
                                    Character.Statistics.Ile_OP++;
                                    Character.Statistics.Opanowanie += 5;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_OP) * 100;
                                    break;

                                case 6:
                                    Character.Statistics.Ile_ODP++;
                                    Character.Statistics.Odpornosc += 5;
                                    Character.Profile.Exp -= (Character.Statistics.Ile_ODP) * 100;
                                    Character.Profile.Statistics.Wytrzymalosc = Character.Statistics.Odpornosc / 10;
                                    break;
                            }
                        }
                    }

                    else if (HUDStats.Stats[i].AddAble && HUDStats.Stats[i].IsOverRemovePoint() && HUDStats.Stats[i].RemovePoint_Available)
                    {
                        switch (i)
                        {
                            case 0:
                                Character.Statistics.Ile_WW--;
                                Character.Statistics.WalkaWrecz -= 5;
                                Character.Profile.Exp += (Character.Statistics.Ile_WW + 1) * 100;
                                break;

                            case 1:
                                Character.Statistics.Ile_KR--;
                                Character.Statistics.Krzepa -= 5;
                                Character.Profile.Exp += (Character.Statistics.Ile_KR + 1) * 100;
                                Character.Statistics.Sila = Character.Statistics.Krzepa / 10;
                                break;

                            case 2:
                                Character.Statistics.Ile_ZR--;
                                Character.Statistics.Zrecznosc -= 5;
                                Character.Profile.Exp += (Character.Statistics.Ile_ZR + 1) * 100;
                                break;

                            case 3:
                                Character.Statistics.Ile_ZY--;
                                Character.Statistics.Zywotnosc -= 1;
                                Character.Profile.Exp += (Character.Statistics.Ile_ZY + 1) * 100;
                                break;

                            case 4:
                                Character.Statistics.Ile_CH--;
                                Character.Statistics.Charyzma -= 5;
                                Character.Profile.Exp += (Character.Statistics.Ile_CH + 1) * 100;
                                break;

                            case 5:
                                Character.Statistics.Ile_OP--;
                                Character.Statistics.Opanowanie -= 5;
                                Character.Profile.Exp += (Character.Statistics.Ile_OP + 1) * 100;
                                break;

                            case 6:
                                Character.Statistics.Ile_ODP--;
                                Character.Statistics.Odpornosc -= 5;
                                Character.Profile.Exp += (Character.Statistics.Ile_ODP + 1) * 100;
                                Character.Profile.Statistics.Wytrzymalosc = Character.Statistics.Odpornosc / 10;
                                break;
                        }
                    }

                    else if (HUDStats.IsOverZmiany())
                    {
                        StatisticsB4 = Character.Statistics.statistics_Clone();
                        ExpB4 = Character.Profile.Exp;
                        SwitchState(HumanControllerState.FREE);
                    }
                }
            }

            if (HUDStats.IsOverZmiany())
            {
                HUDStats.Zmiany.SetColor(new ColourValue(1.0f, 0, 0.2f), new ColourValue(1, 1.0f, 0.6f));
            }

            else
            {
                HUDStats.Zmiany.SetColor(new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f));
            }

            if (Engine.Singleton.IsKeyTyped(MOIS.KeyCode.KC_C))
            {
                SwitchState(HumanControllerState.FREE);
                HUDStats.IsVisible = false;
            }
        }