示例#1
0
 public void Initialize()
 {
     NumericBox.Initialize();
     ActionPointManager.Initialize();
     CurrentHealth.SetMaxValue(NumericBox.HealthPoint_I.Value);
     CurrentHealth.Reset();
 }
示例#2
0
        // Continuesly reading memory and updating the UI
        private async void OnTickMemoryRead()
        {
            if (openProc)
            {
                CurrentHealth            = m.readInt("GameAssembly.dll+00E4FAB8,0xB8,0x0,0x1C8,0x10,0x28,0x148");
                txtbx_currentHealth.Text = CurrentHealth.ToString();

                EnemyCurrentHealth            = m.readInt("GameAssembly.dll+00C2BE60,0x78,0x70,0x20,0x10,0xA2C");
                txtbx_enemyCurrentHealth.Text = EnemyCurrentHealth.ToString();

                IsFight = m.readInt("GameAssembly.dll+00E4EE78,0xB8,0x0,0x950,0xE8,0x228");
                txtbx_fightState.Text = IsFight.ToString();

                EncounterPokeIndex   = m.readInt("GameAssembly.dll+00E4B510,0xB8,0x20,0x98,0x38,0xA24");
                txtbx_pokemonID.Text = EncounterPokeIndex.ToString();

                //PokeDollars = m.readInt("GameAssembly.dll+00A508B0,0xB8,0x48,0xB8,0x298,0x290");
                //txtbx_pokeDollar.Text = PokeDollars.ToString();

                XPos            = (int)Math.Ceiling(m.readFloat("UnityPlayer.dll+015F5600,0xB8,0x18,0x18,0xE0,0x90"));
                txtbx_xPos.Text = XPos.ToString();


                YPos            = (int)Math.Abs(Math.Ceiling(m.readFloat("GameAssembly.dll+00E5B690,0x90,0x28,0xB8,0x20,0x278,0x230")));
                txtbx_yPos.Text = YPos.ToString();

                txtbx_currentPP1.Text = AbilityPP1.ToString();

                await Task.Delay(100);

                OnTickMemoryRead();
            }
        }
示例#3
0
    /**
     * an enemy hit us -> take the specified amount of damage
     */
    public void TakeDamage(int dmg)
    {
        if (deflects.Count != 0)
        {
            dmg -= (int)Mathf.Floor(dmg * (totalDeflected / 100));
            deflects.Clear();
            deflectImage.enabled = false;
            deflectImage.gameObject.GetComponentInChildren <TextMeshProUGUI>().enabled = false;
            totalDeflected = 1f;
        }

        if (shield == 0)
        {
            CurrentHealth -= dmg;
        }
        else
        {
            if (dmg >= shield)
            {
                dmg   -= shield;
                shield = 0;
                ToggleShield(false);
                CurrentHealth -= dmg;
            }
            else
            {
                shield -= dmg;
                ToggleShield(true);
            }
        }
        healthText.text = CurrentHealth.ToString() + "/" + maxHealth.ToString();
        slider.value    = CurrentHealth;
    }
示例#4
0
 public override void Awake()
 {
     AddComponent <CombatAttributeComponent>();
     AddComponent <ActionPointManagerComponent>();
     AddComponent <ConditionManagerComponent>();
     CurrentHealth.SetMaxValue((int)AttributeComponent.HealthPoint.Value);
     CurrentHealth.Reset();
 }
示例#5
0
 public void Initialize()
 {
     NumericBox.Initialize();
     ActionPointManager.Initialize();
     AddComponent <ConditionEventManagerComponent>();
     CurrentHealth.SetMaxValue(NumericBox.HealthPoint_I.Value);
     CurrentHealth.Reset();
 }
示例#6
0
 static public void TakeDamage(int damage)
 {
     if (health <= 0)
     {
         return;
     }
     health = health - damage;
     CurrentHealth.UpdateHealth();
 }
示例#7
0
 public override void Awake()
 {
     AddComponent <AttributeManageComponent>();
     AddComponent <ActionPointManageComponent>();
     AddComponent <ConditionManageComponent>();
     CurrentHealth.SetMaxValue((int)AttributeComponent.HealthPoint.Value);
     CurrentHealth.Reset();
     CombatContext = (CombatContext)Global.GetTypeChildren <CombatContext>()[0];
 }
 public void ResetToDefaults(PlayerCharacterModel data)
 {
     MaxHealth = data.MaxHealth;
     CurrentHealth.SetValueAndForceNotify(data.MaxHealth);
     Damage = data.Damage;
     Position.SetValueAndForceNotify(data.Position.Value);
     Rotation = data.Rotation;
     OnReset?.Execute(this);
 }
示例#9
0
 // Start is called before the first frame update
 void Start()
 {
     if (ChallengeManager.OneHitDeath)
     {
         health = 1;
         CurrentHealth.UpdateHealth();
     }
     rb = GetComponent <Rigidbody2D>();
     wm = GetComponent <WeaponManager>();
 }
示例#10
0
    protected override void Start()
    {
        base.Start();

        tmp = GetComponentInChildren <TextMeshPro> ();

        aSource = GetComponentInChildren <AudioSource> ();

        tmp.text = CurrentHealth.ToString();
    }
示例#11
0
 public override void Awake()
 {
     AddComponent <AttributeComponent>();
     AddComponent <ActionPointManageComponent>();
     AddComponent <ConditionManageComponent>();
     //AddComponent<MotionComponent>();
     CurrentHealth.SetMaxValue((int)GetComponent <AttributeComponent>().HealthPoint.Value);
     CurrentHealth.Reset();
     AttackAbility = Entity.CreateWithParent <AttackAbility>(this);
 }
示例#12
0
    public override void Hit(Vector3 hitPoint, Vector3 from, float amount)
    {
        base.Hit(hitPoint, from, amount);

        if (aSource.isPlaying == false)
        {
            aSource.Play();
        }

        tmp.text = CurrentHealth.ToString();
    }
示例#13
0
    /**
     * our max health increases by the amount specified
     */
    public void IncreaseMaxHealth(int health)
    {
        CurrentHealth += (health * maxHealth) / 100;
        maxHealth     += (health * maxHealth) / 100;

        slider.transform.parent.GetComponent <RectTransform>().sizeDelta = new Vector2(maxHealth, 20);
        healthText.text = CurrentHealth.ToString() + "/" + maxHealth.ToString();
        slider.transform.parent.GetComponent <RectTransform>().sizeDelta = new Vector2(maxHealth * 2, 80);
        slider.maxValue = maxHealth;
        slider.value    = CurrentHealth;
        AudioSource.PlayClipAtPoint(gotHealthSFX, Camera.main.transform.position);
    }
示例#14
0
    /// <summary>
    /// 观察者接收函数
    /// </summary>
    /// <param name="sub"></param>
    public void UpdateData(ISubject sub)
    {
        Player temp = sub as Player;

        #region 基础属性
        RespawnPos    = new Vector2(temp.RespawnPosX, temp.RespawnPosY);
        MaxHealth     = temp.MaxHp;
        CurrentHealth = temp.HP + tempMaxHp;
        Debug.Log("当前生命值为" + CurrentHealth.ToString());
        MaxSp     = temp.MaxSp;
        SP        = temp.SP;
        Speed     = temp.Speed;
        JumpForce = temp.JumpForce;
        BaseATK   = temp.BaseATK;
        #endregion

        #region 基础加成数值
        //只有这堆基础加成数值只需读一次(因为不会变)
        if (firstTimeSetAttri)
        {
            tempMaxHp          = 0;
            firstTimeSetAttri  = false;
            MagicAtkRate       = temp.MagicAtkBaseRate;
            MagicCostRate      = temp.MagicCostBaseRate;
            RecoilForceRate    = temp.RecoilForceBaseRate;
            FallBackRate       = temp.FallBackBaseRate;
            HitRecoverRate     = temp.HitRecoverBaseRate;
            AttackIntervalRate = temp.AttackIntervalBaseRate;
            AttackDistanceRate = temp.AttackDistanceBaseRate;
            SprintCDRate       = temp.SprintCDBaseRate;
            AtkRate            = temp.AtkBaseRate;
            KnockBackRate      = temp.KnockBackBaseRate;
            HealingSpeedRate   = temp.HealingSpeedBaseRate;
            HealingAmountRate  = temp.HealingAmountBaseRate;
            SPIncreaseRate     = temp.SPIncreaseBaseRate;
            SpeedRate          = temp.SpeedBaseRate;
            MoneyRate          = temp.MoneyBaseRate;
        }
        #endregion

        #region 状态判断
        IsDying = CurrentHealth > 2 ? false : true;
        Debug.Log(IsDying);
        #endregion
    }
示例#15
0
 /**
  * we gain the amount of health specified
  */
 public void GainHealth(int health)
 {
     if (CombatManager.inCombat)
     {
         AudioSource.PlayClipAtPoint(gotHealthSFX, combatCamera.transform.position);
     }
     else
     {
         AudioSource.PlayClipAtPoint(gotHealthSFX, Camera.main.transform.position);
     }
     CurrentHealth += (health * maxHealth) / 100;
     if (CurrentHealth > maxHealth)
     {
         CurrentHealth = maxHealth;
     }
     healthText.text = CurrentHealth.ToString() + "/" + maxHealth.ToString();
     slider.value    = CurrentHealth;
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (pokemonData_ != null)
            {
                hash ^= PokemonData.GetHashCode();
            }
            if (CurrentHealth != 0)
            {
                hash ^= CurrentHealth.GetHashCode();
            }
            if (CurrentEnergy != 0)
            {
                hash ^= CurrentEnergy.GetHashCode();
            }
            return(hash);
        }
示例#17
0
    // Update is called once per frame
    void Update()
    {
        string healthValue = "";

        healthValue += CurrentHealth.ToString("0");

        health.text = healthValue + "%";

        // Deal damage to player overtime
        DealDamage(0.01f);

        /*
         * if (Input.GetKeyDown(KeyCode.X))
         * {
         *  DealDamage(6);
         * }
         */
    }
示例#18
0
 public override void Awake()
 {
     AddComponent <AttributeComponent>();
     AddComponent <ActionPointManageComponent>();
     AddComponent <ConditionManageComponent>();
     //AddComponent<MotionComponent>();
     CurrentHealth.SetMaxValue((int)GetComponent <AttributeComponent>().HealthPoint.Value);
     CurrentHealth.Reset();
     SpellActionAbility        = AttachActionAbility <SpellActionAbility>();
     MotionActionAbility       = AttachActionAbility <MotionActionAbility>();
     DamageActionAbility       = AttachActionAbility <DamageActionAbility>();
     CureActionAbility         = AttachActionAbility <CureActionAbility>();
     AttackActionAbility       = AttachActionAbility <AttackActionAbility>();
     AssignEffectActionAbility = AttachActionAbility <AssignEffectActionAbility>();
     TurnActionAbility         = AttachActionAbility <TurnActionAbility>();
     JumpToActionAbility       = AttachActionAbility <JumpToActionAbility>();
     AttackAbility             = CreateChild <AttackAbility>();
 }
示例#19
0
    void Update()
    {
        if (canvasParent != null)
        {
            canvasParent.SetActive(isEnabled);
        }

        if (isEnabled)
        {
            // Prevents the var being constantly updated.
            if (CurrentHealth != entity.CurrentHealth)
            {
                CurrentHealth = entity.CurrentHealth;
            }
            if (MaximumHealth != entity.MaximumHealth)
            {
                MaximumHealth = entity.MaximumHealth;
            }
            if (CurrentMana != entity.CurrentMana)
            {
                CurrentMana = entity.CurrentMana;
            }
            if (MaximumMana != entity.MaximumMana)
            {
                MaximumMana = entity.MaximumMana;
            }

            // Health
            SetResourceBar(healthPanel, CurrentHealth, MaximumHealth);
            SetResourceBarText(healthPanelActual, CurrentHealth.ToString("N0"), MaximumHealth);
            SetResourceBarText(healthPanelPercetage, (CurrentHealth / MaximumHealth).ToString("P"), MaximumHealth);

            // Mana
            SetResourceBar(manaPanel, CurrentMana, MaximumMana);
            SetResourceBarText(manaPanelActual, CurrentMana.ToString("N0"), MaximumMana);
            SetResourceBarText(manaPanelPercetage, (CurrentMana / MaximumMana).ToString("P"), MaximumMana);
        }
    }
示例#20
0
        private void Start()
        {
            CurrentHealth.Subscribe(x =>
            {
                if (gameObject.CompareTag("Player"))
                {
                    _audioSource.PlayOneShot(Resources.Load <AudioClip>("SFX/S_Hit01"));
                }

                if (x > _maxHealth)
                {
                    CurrentHealth.Value = _maxHealth;
                }

                if (CurrentHealth.Value <= 0)
                {
                    OnDeath.OnNext(gameObject);
                }
            })
            .AddTo(this);

            OnDeath.Subscribe(HandleDeath);
        }
示例#21
0
    /**
     * we must have died (or otherwise starting a new game).
     * wipe all of our info and set necessary base values.
     */
    public void Reset()
    {
        CurrentHealth = maxHealth;

        // destroy all weapons
        for (var i = 0; i < weapons.Length; ++i)
        {
            if (weapons[i] != null)
            {
                weapons[i].DestroyUI();
                Destroy(weapons[i]);
            }
        }

        items = new List <Item>();

        // create started weapon and pick it up
        weapons = new Weapon[1] {
            gameObject.Instantiate(weaponPrefab, 1).GetComponent <Weapon>()
        };
        weapons[0].WeaponPickedUp(keyCodes[0], 0);

        // reset base values
        EnemiesKilled  = 0;
        TilNextSlot    = 1;
        WeaponSlots    = 1;
        gold           = 0;
        shield         = 0;
        deflects       = new List <float>();
        totalDeflected = 0;

        // reset UI values
        healthText.text = CurrentHealth.ToString() + "/" + maxHealth.ToString();
        slider.maxValue = maxHealth;
        slider.value    = CurrentHealth;
        goldText.text   = "0";
    }
示例#22
0
        // ctor
        private HealthListener()
        {
            _request     = new Request(Utils.Config.BackEndSession.GetPhpSessionId(), Utils.Config.BackendUrl);
            _simpleTimer = Common.Utils.Hook.Loader <SimpleTimer> .Load();

            _simpleTimer.syncHealthAction = () => Task.Run(() => _request.PostJson("/player/health/sync", CurrentHealth.ToJson()));
        }
示例#23
0
        public void ReceiveCure(CombatAction combatAction)
        {
            var cureAction = combatAction as CureAction;

            CurrentHealth.Add(cureAction.CureValue);
        }
示例#24
0
        public void ReceiveDamage(CombatAction combatAction)
        {
            var damageAction = combatAction as DamageAction;

            CurrentHealth.Minus(damageAction.DamageValue);
        }
示例#25
0
 private void SetHealthText(CurrentHealth currentHealth)
 {
     this.Text.text = string.Format("Health: {0}", currentHealth.Health);
 }
示例#26
0
 public PlayerHealthProvider(int health)
 {
     _currentHealth = new IntReactiveProperty(health);
     MaxHealth      = health;
     IsDead         = CurrentHealth.Select(x => x <= 0).ToReactiveProperty();
 }
 /// ------------------------------------------------------------- HUD 관련 ------------------------------------------------------------- ///
 // 플레이어 정보에 따라 UI 업데이트
 void RefreshPlayerUI()
 {
     healthText.text = CurrentHealth.ToString() + "/" + maxHealth.ToString();
     costText.text   = CurrentCost.ToString() + "/" + maxCost.ToString();
     goldText.text   = gold.ToString();
 }