/// <summary>
        /// Assigns the values and settings as specified by this initializer, to the input entity
        /// </summary>
        public void ApplyToPlayer(Entity player)
        {
            if (player == null)
            {
                return;
            }

            RenderComponent renderer = player.Get <RenderComponent>();

            renderer.displayName = name;

            // for each stat, assign the value from the initializers component, to the player entities component
            AttributesComponent playerAttr = player.Get <AttributesComponent>();

            foreach (FieldInfo attrField in attributes.AttributeFields())
            {
                attrField.SetValue(playerAttr, attrField.GetValue(attributes));
            }

            // give the player all of the skills and items they selected
            var playerSkills = player.Get <SkillUserComponent>();

            foreach (Entity e in startingSkills)
            {
                playerSkills.AddNewSkill(e);
            }

            foreach (Entity e in startingItems)
            {
                player.FireEvent(new EAquireItem()
                {
                    item = e
                });
            }
        }
Пример #2
0
 private void LoadDependencies()
 {
     this.AC  = Player.Character.GetComponent <AttributesComponent>();
     this.EC  = Player.Character.GetComponent <EquipmentComponent>();
     this.PCC = Player.Character.GetComponent <PlayerControlComponent>();
     this.SC  = Player.Character.GetComponent <ScoreComponent>();
 }
Пример #3
0
        public void Initialize(Character character)
        {
            this.attributes = character.Entity.GetComponent <AttributesComponent>();
            this.attributes.AttributeChanged += OnAttributeChanged;

            this.properties = character.Entity.GetComponent <PropertiesComponent>();
            this.properties.PropertyChanged += OnPropertyChanged;

            this.experience = character.Entity.GetComponent <ExperienceComponent>();
            this.experience.Experience.Changed += OnExperienceChanged;
            OnExperienceChanged(this.experience.Experience);

            var actor = character.Entity.GetComponent <ActorComponent>();

            this.helmCheckbox.isOn = actor.IsHelmVisible;
            this.helmCheckbox.onValueChanged.AddListener(b => actor.SetHelmVisible(b));

            this.characterNameText.text = character.Name;

            this.dropdown.onValueChanged.AddListener(OnDropdownChanged);
            this.dropdown.options = new List <TMP_Dropdown.OptionData>
            {
                new TMP_Dropdown.OptionData(I18N.Instance.Get("ui_attributes")),
                new TMP_Dropdown.OptionData(I18N.Instance.Get("ui_skills")),
            };

            CreateAttributes(this.attributes);
            CreateProperties(this.properties);
            CreateSkillSlots(character.Entity.GetComponent <SpellbookComponent>().Slots);

            OnDropdownChanged(0);
        }
Пример #4
0
    public void ApplyGameplayEffect(int index, EntityCommandBuffer.Concurrent Ecb, AttributesComponent attributesComponent, float WorldTime)
    {
        var attributeModData = new AttributeModificationComponent()
        {
            Add      = 0,
            Multiply = 0,
            Divide   = 0,
            Change   = 0,
            Source   = Source,
            Target   = Target
        };

        var attributeModEntity = Ecb.CreateEntity(index);
        var gameplayEffectData = new GameplayEffectDurationComponent()
        {
            WorldStartTime = WorldTime,
            Duration       = Duration,
            Effect         = EGameplayEffect.GlobalCooldown
        };
        var cooldownEffectComponent = new CooldownEffectComponent()
        {
            Caster = Source
        };

        Ecb.AddComponent(index, attributeModEntity, new NullAttributeModifier());
        Ecb.AddComponent(index, attributeModEntity, new TemporaryAttributeModification());
        Ecb.AddComponent(index, attributeModEntity, gameplayEffectData);
        Ecb.AddComponent(index, attributeModEntity, attributeModData);
        Ecb.AddComponent(index, attributeModEntity, cooldownEffectComponent);
        Ecb.AddComponent(index, attributeModEntity, new GlobalCooldownTagComponent());
    }
Пример #5
0
        //---------------------------------------------------------------------------

        public override void ReceiveInput(GameActionCollection actions, float deltaTime)
        {
            AttributesComponent attributes = GetComponent <AttributesComponent>();

            if (attributes != null)
            {
                float xMovement = (actions[EGameAction.MOVE_RIGHT].Value - actions[EGameAction.MOVE_LEFT].Value); // * deltaTime * attributes.MovementSpeed* 20;
                float yMovement = (actions[EGameAction.MOVE_DOWN].Value - actions[EGameAction.MOVE_UP].Value);    // * deltaTime * attributes.MovementSpeed * 20;

                Vector3 movement = new Vector3(xMovement, yMovement, 0);
                if (movement.Length() > 0.01f)
                {
                    //ApplyForce(new Vector3(xMovement, yMovement, 0), true);
                    ApplyAbsoluteForce(Vector3.Normalize(movement) * deltaTime * attributes.MovementSpeed * 200.0f);
                }

                float xDirection = (actions[EGameAction.LOOK_RIGHT].Value - actions[EGameAction.LOOK_LEFT].Value);
                float yDirection = (actions[EGameAction.LOOK_DOWN].Value - actions[EGameAction.LOOK_UP].Value);

                Vector2 directon = new Vector2(xDirection, yDirection);
                if (directon.Length() > 0.01f)
                {
                    TransformComponent transform = GetComponent <TransformComponent>();
                    if (transform != null)
                    {
                        transform.OrientateTo(directon);
                    }
                }
            }
        }
Пример #6
0
        public WindowPlayerState(int x, int y, int w, int h, string title, EBorderStyle borderStyle, Entity player, HUD parent)
            : base(x, y, w, h, title, borderStyle, player, parent)
        {
            skillInfoWindow = new WindowSkillInfo(0, 0, 30, 12, "[skill]", EBorderStyle.ALL, player, parent);
            parent.windows.Add(skillInfoWindow);

            playerSkills       = player.Get <SkillUserComponent>();
            playerPhysicsState = player.Get <PhysicsComponent>();
            playerAttributes   = player.Get <AttributesComponent>();
        }
Пример #7
0
        private void CreateAttributes(AttributesComponent attributes)
        {
            this.attributeRows = new Dictionary <AttributeType, CharacterInfoRow>();

            foreach (var attribute in attributes.Attributes.Values.OrderBy(a => a.Index))
            {
                var row = Instantiate(this.valueRowPrefab, this.attributesContainer);
                this.attributeRows.Add(attribute.Type, row);
                RefreshAttributeRow(attribute, row);
            }
        }
Пример #8
0
        public void Initialize(GameObject owner)
        {
            Owner = owner;

            this.properties = Owner.GetComponent <PropertiesComponent>();
            this.attributes = Owner.GetComponent <AttributesComponent>();

            OnInitialize();

            Experience.LevelUp += OnLevelUp;
            OnLevelUp(Experience);
        }
        public void ApplyGameplayEffect(EntityManager EntityManager, AttributesComponent attributesComponent, float WorldTime)
        {
            var attributeModData   = AttributeModData(this.Source, this.Source);
            var attributeModEntity = EntityManager.CreateEntity(
                typeof(ManaAttributeModifier),
                typeof(PermanentAttributeModification),
                typeof(_AttributeModificationComponent),
                typeof(_GameplayEffectDurationComponent)
                );

            EntityManager.SetComponentData(attributeModEntity, attributeModData);
        }
Пример #10
0
    private void DamageTarget(GameObject target)
    {
        AttributesComponent targetAttrComp = target.GetComponent <AttributesComponent>();

        if (targetAttrComp != null)
        {
            targetAttrComp.ApplyDamage(this.kWeaponData.kDamage);
        }
        Projectile projectile = target.GetComponent <Projectile>();

        if (projectile != null && projectile.CanBeDamaged)
        {
            projectile.Explode();
        }
        this.Explode();
    }
Пример #11
0
        public void ApplyGameplayEffect(EntityManager EntityManager, AttributesComponent attributesComponent, float WorldTime)
        {
            var attributeModData = new _AttributeModificationComponent()
            {
                Add      = -ManaCost,
                Multiply = 0,
                Divide   = 0,
                Change   = 0,
                Source   = Source,
                Target   = Target
            };

            var attributeModEntity = EntityManager.CreateEntity(
                typeof(ManaAttributeModifier),
                typeof(PermanentAttributeModification),
                typeof(_AttributeModificationComponent)
                );

            EntityManager.SetComponentData(attributeModEntity, attributeModData);
        }
        public void ApplyGameplayEffect(EntityManager EntityManager, AttributesComponent attributesComponent, float WorldTime)
        {
            var attributeModData   = AttributeModData();
            var attributeModEntity = EntityManager.CreateEntity(
                typeof(_HealthAttributeModifier),
                // typeof(TemporaryAttributeModification),
                typeof(PermanentAttributeModification),
                typeof(_AttributeModificationComponent),
                typeof(_GameplayEffectDurationComponent)
                );


            // var gameplayEffectData = new GameplayEffectDurationComponent()
            // {
            //     WorldStartTime = WorldTime,
            //     Duration = 10,
            //     Effect = EGameplayEffect.HealRegen
            // };


            EntityManager.SetComponentData(attributeModEntity, attributeModData);
            // EntityManager.SetComponentData(attributeModEntity, gameplayEffectData);
        }
 public void ApplyGameplayEffect <T0, T1, T2, T3, T4, T5>(int index, EntityCommandBuffer.Concurrent Ecb, Entity Source, Entity Target, AttributesComponent attributesComponent, float WorldTime)
     where T0 : struct, IComponentData, IGameplayEffect
     where T1 : struct, IComponentData, IGameplayEffect
     where T2 : struct, IComponentData, IGameplayEffect
     where T3 : struct, IComponentData, IGameplayEffect
     where T4 : struct, IComponentData, IGameplayEffect
     where T5 : struct, IComponentData, IGameplayEffect
 {
     ApplyGameplayEffect <T0>(index, Ecb, Source, Target, attributesComponent, WorldTime);
     ApplyGameplayEffect <T1>(index, Ecb, Source, Target, attributesComponent, WorldTime);
     ApplyGameplayEffect <T2>(index, Ecb, Source, Target, attributesComponent, WorldTime);
     ApplyGameplayEffect <T3>(index, Ecb, Source, Target, attributesComponent, WorldTime);
     ApplyGameplayEffect <T4>(index, Ecb, Source, Target, attributesComponent, WorldTime);
     ApplyGameplayEffect <T5>(index, Ecb, Source, Target, attributesComponent, WorldTime);
 }
Пример #14
0
 public void CreatePeriodicEffectEntity(int index, EntityCommandBuffer.Concurrent Ecb, AttributesComponent attributesComponent, float WorldTime)
 {
     throw new System.NotImplementedException();
 }
    public void ApplyGameplayEffect <T0>(int index, EntityCommandBuffer.Concurrent Ecb, Entity Source, Entity Target, AttributesComponent attributesComponent, float WorldTime)
        where T0 : struct, IComponentData, IGameplayEffect
    {
        var effect = new T0();

        effect.Source = Source;
        effect.Target = Target;
        effect.ApplyGameplayEffect(index, Ecb, attributesComponent, WorldTime);
    }
Пример #16
0
        public void ApplyGameplayEffect(int index, EntityCommandBuffer.Concurrent Ecb, AttributesComponent attributesComponent, float WorldTime)
        {
            var attributeModData = AttributeModData();

            var attributeModEntity = Ecb.CreateEntity(index);

            Ecb.AddComponent(index, attributeModEntity, new _HealthAttributeModifier());
            // Ecb.AddComponent(index, attributeModEntity, new TemporaryAttributeModification());
            Ecb.AddComponent(index, attributeModEntity, new PermanentAttributeModification());
            // Ecb.AddComponent(index, attributeModEntity, gameplayEffectData);

            Ecb.AddComponent(index, attributeModEntity, attributeModData);
        }
Пример #17
0
 public void ApplyGameplayEffect(EntityManager EntityManager, AttributesComponent attributesComponent, float WorldTime)
 {
 }
Пример #18
0
 private void OnAttributePointsChanged(AttributesComponent attributes)
 {
     View.SetUnspentPoints(attributes.Points);
     UpdateSpendButtons();
 }
Пример #19
0
 public AttributesComponent ComputeResourceUsage(Entity Caster, AttributesComponent attributes)
 {
     attributes.Mana.CurrentValue -= ManaCost;
     return(attributes);
 }
Пример #20
0
    public void PermanentAttributeModification(ref AttributeModificationComponent attrMod, ref AttributesComponent attrs)
    {
        var attr = attrs.Health;

        attrMod.Change  = attrMod.Add + (attr.BaseValue * attrMod.Multiply) + (attrMod.Divide != 0 ? attr.BaseValue / attrMod.Divide : 0);
        attr.BaseValue += attrMod.Change;
        attrs.Health    = attr;
    }
Пример #21
0
        public void ApplyGameplayEffect(int index, EntityCommandBuffer.Concurrent Ecb, AttributesComponent attributesComponent, float WorldTime)
        {
            var attributeModData = new _AttributeModificationComponent()
            {
                Add      = -ManaCost,
                Multiply = 0,
                Divide   = 0,
                Change   = 0,
                Source   = Source,
                Target   = Target
            };

            var attributeModEntity = Ecb.CreateEntity(index);

            Ecb.AddComponent(index, attributeModEntity, new ManaAttributeModifier());
            Ecb.AddComponent(index, attributeModEntity, new PermanentAttributeModification());
            Ecb.AddComponent(index, attributeModEntity, attributeModData);
        }
 public void PermanentAttributeModification(ref AttributeModificationComponent attrMod, ref AttributesComponent attrs)
 {
 }
Пример #23
0
        public List <OrganizationsModel> GetOrganization(Guid organization, int?userId = -1, string language = "en-US")
        {
            try
            {
                var currentUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();

                //lists
                List <OrganizationsModel> ListOrganization = new List <OrganizationsModel>();

                List <string> ListLogo = new List <string>();

                List <ReferencesModel> ListReference = new List <ReferencesModel>();

                List <AccreditationsModel> ListAccreditation = new List <AccreditationsModel>();

                List <AttributesModel> ListAttributes = new List <AttributesModel>();

                List <UserProfileModel> ListuserInfo = new List <UserProfileModel>();

                //get attributes
                var attributes = AttributesComponent.GetAttributesList(organization).ToList();

                foreach (var item in attributes)
                {
                    ListAttributes.Add(new AttributesModel()
                    {
                        AttributeID    = item.AttributeID,
                        OrganizationID = item.OrganizationID,
                        Type           = item.Type,
                        Value          = item.Value,
                        ValueType      = item.ValueType,
                        Description    = item.Description,
                        Label          = item.Label
                    });
                }

                //get number of solution
                var solutionsNumber = SolutionComponent.GetSolutionPerOrganization(organization).ToList().Count();

                //get partners
                var partnersLogo = PartnershipsComponent.GetPartnershipListLogo(organization).ToList();

                //get organizations by Id
                var List = OrganizationComponent.GetOrganizationPerId(organization).ToList();

                //get organization references by Id
                var resultReferences = ReferencesComponent.GetReferences(organization).ToList();

                //get user info
                var users = List.First().UserOrganizations.Where(a => a.Role == 1);

                //know if current user is owner
                bool owner = false;
                if (currentUser.UserID == users.First().UserID || currentUser.IsInRole("Administrators") || currentUser.IsSuperUser)
                {
                    owner = true;
                }


                var userProfile = new UserPropertyComponent(users.First().UserID);

                // UserProfileModel userProfile = user.GetProfile(Convert.ToInt32(List.First().CreatedBy));

                string finalExt = "";
                if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("~\\Portals\\0\\ModIma\\UserProfileImages\\" + userProfile.UserProperty.ProfilePicture + ".png")))
                {
                    finalExt = "\\Portals\\0\\ModIma\\UserProfileImages\\" + userProfile.UserProperty.ProfilePicture + ".png";
                }
                else if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("~\\Portals\\0\\ModIma\\UserProfileImages\\" + userProfile.UserProperty.ProfilePicture + ".jpg")))
                {
                    finalExt = "\\Portals\\0\\ModIma\\UserProfileImages\\" + userProfile.UserProperty.ProfilePicture + ".jpg";
                }
                else
                {
                    finalExt = "\\Portals\\0\\ModIma\\UserProfileImages\\defaultImage.png";
                }


                if (resultReferences.Count() > 0)
                {
                    foreach (var item in resultReferences)
                    {
                        var userProfileReferences = new UserPropertyComponent(item.UserId);

                        ListReference.Add(new ReferencesModel()
                        {
                            ReferenceId    = (Guid)item.ReferenceId,
                            OrganizationId = (Guid)item.OrganizationId,
                            UserId         = item.UserId,
                            Type           = item.Type,
                            Comment        = item.Comment,
                            Created        = item.Created.ToString(),
                            Updated        = item.Updated.ToString(),
                            Deleted        = item.Deleted,
                            fullName       = userProfileReferences.UserProperty.FirstName + " " + userProfileReferences.UserProperty.LastName
                        });
                    }
                }

                //Get organization accreditations
                var resultAccreditations = AccreditationsComponent.GetAccreditationId(organization).ToList();

                if (resultAccreditations.Count() > 0)
                {
                    foreach (var item in resultAccreditations)
                    {
                        DocumentComponent doc = new DocumentComponent((Guid)item.DocumentId);

                        ListAccreditation.Add(new AccreditationsModel()
                        {
                            AccreditationId   = (Guid)item.AccreditationId,
                            OrganizationId    = (Guid)item.OrganizationId,
                            Content           = item.Content,
                            Description       = item.Description,
                            DocumentId        = (Guid)item.DocumentId,
                            Name              = item.Name,
                            Type              = item.Type,
                            yearAccreditation = item.Year,
                            docName           = doc.Document.Name,
                            docUrl            = ""
                        });
                    }
                }

                foreach (var item in List)
                {
                    ListOrganization.Add(new OrganizationsModel()
                    {
                        OrganizationID = (Guid)item.OrganizationID,
                        Code           = item.Code,
                        Name           = item.Name,
                        //Address = currentUser.IsInRole("NexsoUser") ? item.Address : "",
                        Address = item.Address,
                        //Phone = currentUser.IsInRole("NexsoUser") ? item.Phone  : "",
                        Phone = item.Phone,
                        //Email = currentUser.IsInRole("NexsoUser") ? item.Email : "",
                        Email = item.Email,
                        //ContactEmail = currentUser.IsInRole("NexsoUser") ? item.ContactEmail : "",
                        ContactEmail = item.ContactEmail,
                        Website      = item.Website,
                        Twitter      = item.Twitter,
                        //Skype = currentUser.IsInRole("NexsoUser") ? item.Skype : "",
                        Skype = item.Skype,
                        //Facebook = currentUser.IsInRole("NexsoUser") ? item.Facebook : "",
                        Facebook           = item.Facebook,
                        GooglePlus         = item.GooglePlus,
                        LinkedIn           = item.LinkedIn,
                        Description        = item.Description,
                        Logo               = item.Logo,
                        Country            = item.Country,
                        Region             = item.Region,
                        City               = item.City,
                        ZipCode            = item.ZipCode,
                        Created            = Convert.ToDateTime(item.Created),
                        Updated            = Convert.ToDateTime(item.Updated),
                        Latitude           = Convert.ToDecimal(item.Latitude),
                        Longitude          = Convert.ToDecimal(item.Longitude),
                        GoogleLocation     = item.GoogleLocation,
                        Language           = item.Language,
                        Year               = Convert.ToInt32(item.Year),
                        Staff              = Convert.ToInt32(item.Staff),
                        Budget             = Convert.ToDecimal(item.Budget),
                        CheckedBy          = item.CheckedBy,
                        CreatedOn          = Convert.ToDateTime(item.Created),
                        UpdatedOn          = Convert.ToDateTime(item.Updated),
                        CreatedBy          = Convert.ToInt32(item.CreatedBy),
                        Deleted            = Convert.ToBoolean(item.Deleted),
                        accreditations     = ListAccreditation,
                        references         = ListReference,
                        solutionNumber     = Convert.ToInt32(solutionsNumber),
                        partnershipsLogo   = partnersLogo,
                        attributes         = ListAttributes,
                        userFirstName      = userProfile.UserProperty.FirstName,
                        userLastName       = userProfile.UserProperty.LastName,
                        userEmail          = userProfile.UserProperty.email,
                        userLinkedIn       = userProfile.UserProperty.LinkedIn,
                        userFacebook       = userProfile.UserProperty.FaceBook,
                        userTwitter        = userProfile.UserProperty.Twitter,
                        userAddress        = userProfile.UserProperty.Address,
                        userCity           = userProfile.UserProperty.City,
                        userCountry        = userProfile.UserProperty.Country,
                        userProfilePicture = finalExt,
                        userID             = currentUser.UserID.ToString(),
                        ownerSolution      = owner
                    });
                }
                return(ListOrganization);
            }
            catch (HttpResponseException e)
            {
                throw e;
            }
            catch (Exception ee)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ee);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
Пример #24
0
 private void OnAttributeChanged(AttributesComponent attributes, Attribute attribute)
 {
     View.Refresh();
 }
 public void ApplyGameplayEffect(EntityManager EntityManager, AttributesComponent attributesComponent, float WorldTime)
 {
     throw new System.NotImplementedException();
 }
Пример #26
0
 private void OnAttributePointsChanged(AttributesComponent attributes)
 {
     UpdateAttributePointsBadge();
 }
Пример #27
0
 private void OnAttributeChanged(AttributesComponent attributes, Attribute attribute)
 {
     this.requiresUpdate = true;
 }
        public void ApplyGameplayEffect(int index, EntityCommandBuffer.Concurrent Ecb, AttributesComponent attributesComponent, float WorldTime)
        {
            var attributeModData   = AttributeModData(this.Source, this.Source);
            var attributeModEntity = Ecb.CreateEntity(index);

            Ecb.AddComponent(index, attributeModEntity, new ManaAttributeModifier());
            Ecb.AddComponent(index, attributeModEntity, new PermanentAttributeModification());
            Ecb.AddComponent(index, attributeModEntity, attributeModData);
        }
Пример #29
0
 public NavigationViewController(INavigationView view, CharacterManager characterManager) : base(view)
 {
     this.talents    = characterManager.Character.Entity.GetComponent <TalentsComponent>();
     this.attributes = characterManager.Character.Entity.GetComponent <AttributesComponent>();
 }
 public void TemporaryAttributeModification(ref AttributeModificationComponent attrMod, ref AttributesComponent attrs)
 {
 }