Esempio n. 1
0
        public static void ApplyPayload(BaseEntity2D owner, ValidatePayload payload)
        {
            AbstractApplierEffector[] effectors = owner.GetComponents <AbstractApplierEffector>();

            for (int index = 0; index < effectors.Length; index++)
            {
                effectors[index].ApplyPayload(payload);
            }
        }
        protected override void Activate()
        {
            base.Activate();

            Transform mountPoint = owner.GetMountPoint(ComponentDefs.Foot);

            if (mountPoint != null)
            {
                effector = ResourceUtils.GetComponent <tk2dSpriteAnimator>(GlobalDefinitions.RESOURCE_PATH_BUFF + data.resourceID);
                effector.transform.SetParent(mountPoint);
                effector.transform.localPosition = Vector3.zero;

                effector.AnimationEventTriggered = (tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) =>
                {
                    ValidatePayload payload = owner.data.attributeBox.ValidateDirect(ValidateType.Injured, AttributeKeys.HP, AttributeSetTypes.BaseValue, data.parameter2);
                    payload.hitPoint = owner.gameObject.transform.position;

                    EventBox.Send(CustomEvent.DUNGEON_MONSTER_DAMAGE, new object[] { owner, payload });
                };
            }
        }
Esempio n. 3
0
        public override void Begin(object data = null)
        {
            base.Begin();

            payload = data as ValidatePayload;

            GetContext().hudContainer.DestroyChildren();

            MonsterData monster = GetContext().data as MonsterData;

            foreach (AbstractApplierEffector effector in GetContext().GetComponents <AbstractApplierEffector>())
            {
                effector.Cancel();
            }

            if (int.Parse(monster.explosionID) > 0)
            {
                explosionTask = new Task(ExplosionProcessor());
            }
            else
            {
                DeadProcessor();
            }
        }
Esempio n. 4
0
        public void Initialize(ValidatePayload payload)
        {
            if (payload.isCRT)
            {
                if (payload.finalCRT == 2)
                {
                    value2Label.gameObject.SetActive(true);

                    value2Label.text = payload.damage.ToString();
                }
                else if (payload.finalCRT >= 3)
                {
                    value3Label.gameObject.SetActive(true);

                    value3Label.text = payload.damage.ToString();
                }
            }
            else
            {
                valueLabel.gameObject.SetActive(true);

                valueLabel.text = payload.damage.ToString();
            }
        }
        private void OnDungeonMonsterDamage(object data)
        {
            object[] datas = data as object[];

            MonsterEntity2D entity  = datas[0] as MonsterEntity2D;
            ValidatePayload payload = datas[1] as ValidatePayload;

            DamagePopUpUI view = LayerManager.GetInstance().AddPopUpView <DamagePopUpUI>();

            view.Initialize(payload);

            view.transform.position = entity.GetMountPoint(ComponentDefs.HUD).transform.position;

            float currentHP = entity.data.attributeBox.GetAttribute(AttributeKeys.HP);
            float maxHP     = entity.data.attributeBox.GetAttribute(AttributeKeys.MaxHP);
            float percent   = currentHP / maxHP;

            entity.UpdateHUD();

            entity.componentsHolder.ValidateAndUpdate(percent);

            foreach (EntityComponent component in entity.componentsHolder.components)
            {
                component.Blink();
            }

            if (entity.data.attributeBox.GetAttribute(AttributeKeys.HP) <= 0)
            {
                EventBox.Send(CustomEvent.TROPHY_UPDATE, new KeyValuePair <TrophyType, float>(TrophyType.DungeonKillMonster, 1));

                entity.machine.ChangeState(StateTypes.Dead.ToString(), payload);

                float value = entity.data.attributeBox.GetAttribute(AttributeKeys.RP);

                if (value != 0)
                {
                    UserManager.GetInstance().AddRP(value);
                }

                value = entity.data.attributeBox.GetAttribute(AttributeKeys.GP);

                if (value != 0)
                {
                    UserManager.GetInstance().AddGP(value);
                }

                if (monsters.Contains(entity))
                {
                    monsters.Remove(entity);
                }

                if (entity is BossEntity2D)
                {
                    EndBattle(BattleResult.Win);
                }
                else
                {
                    if (monsters.Count == 0)
                    {
                        if (dungeon.currentGroup != null && dungeon.currentGroup.HasMonsters())
                        {
                            CreateAllMonsterGroup();
                        }
                        else
                        {
                            CheckBattleResult();
                        }
                    }
                }
            }
        }
Esempio n. 6
0
 public virtual void ApplyPayload(ValidatePayload payload)
 {
 }
Esempio n. 7
0
 public override void ApplyPayload(ValidatePayload payload)
 {
     payload.damage = (int)(payload.damage * (1 + data.parameter1));
 }
Esempio n. 8
0
 public async Task <YggdrasilResponse <ValidateResponse> > ValidateAsync(ValidatePayload payload)
 => await PostAsync <ValidateResponse, ValidatePayload>("/validate", payload);