示例#1
0
        void UpdateShooting()
        {
            if (GameManager.isPaused)
            {
                return;
            }

            if (ActionsInterface.GetActionDown(shootAction))
            {
                if (hitActor != null)
                {
                    hitActor.AddModifiers(damageModifiers, "Shoot", true, GameManager.playerActor.gameObject, hitActor.gameObject);

                    GameValue npcHealth = hitActor.GetGameValueObject(healthBarGameValueName);
                    if (npcHealth.GetValueComponent(GameValue.GameValueComponent.BaseValue) <= 0)
                    {
                        npcHealth.ReInitialize();
                        GameManager.playerActor.AddModifiers(onKillModifiers, "On Kill", true, hitActor.gameObject, GameManager.playerActor.gameObject);
                    }
                }

                clip--;
                if (clip <= 0)
                {
                    clip  = maxClip;
                    ammo -= maxClip;
                    ammoHud.allTexts[1].SetText("| " + ammo.ToString());
                }
                ammoHud.allTexts[0].SetText(clip.ToString() + " ");
            }
        }
示例#2
0
        // float health = 100;
        void GiveDamage(float damage)
        {
            Actor.playerActor.AddModifiers(damageModifiers, "Damage", true, gameObject, Actor.playerActor.gameObject);

            if (healthGameValue.GetValueComponent(GameValue.GameValueComponent.BaseValue) <= 0)
            {
                healthGameValue.ReInitialize();
            }

            // health -= damage;
            // if (health <= 0) {
            //     health = 100;
            // }
            // UpdateHealthBar();
        }