示例#1
0
        public Main(int mode)
        {
            Mode = mode;

            this.logger       = new LogHelper(Main.Mode);
            this.healthHelper = new HealthHelper(Main.Mode);
        }
示例#2
0
    void Start()
    {
        healthHelper  = GameObject.FindObjectOfType <HealthHelper>();  // reference to HealthHelper script
        benefitHelper = GameObject.FindObjectOfType <BenefitHelper>(); // reference to BenefitHelper script

        SpawnMonster();                                                // Function to spawn new Monster
    }
示例#3
0
    //поиск врагов
    private IEnumerator Timer()
    {
        //найти всех персонажей, и добавить их в массив, если их группа отлична от собственной

        HealthHelper[] targets = GameObject.FindObjectsOfType <HealthHelper>().Where
                                     (p => p.Group != _healthHelper.Group).ToArray();

        if (targets.Length == 0)
        {
            yield return(new WaitForSeconds(1f));

            StartCoroutine(Timer());
        }
        else
        {
            //Выбрать рандомно одного из персонажей в этой группе.
            _target = targets[UnityEngine.Random.Range(0, targets.Length)];

            //если не мертв, продолжить поиск врагов через 5 сек
            if (!_healthHelper.Dead)//можно добавить дополнительное условие - если противник не мертв.
            {
                yield return(new WaitForSeconds(5));

                StartCoroutine(Timer());
            }
        }
    }
示例#4
0
        static bool Prefix(ref Thing __result, Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map)
        {
            if (!PatchMedicalRecipesUtilityIsCleanAndDroppable.HasAnyMutations(pawn, part))
            {
                return(true);
            }

            ThingDef thingDef;

            if (!Radiology.bodyPartItems.TryGetValue(part.def, out thingDef))
            {
                return(true);
            }

            Thing             thing = GenSpawn.Spawn(thingDef, pos, map, WipeMode.Vanish);
            CompHediffStorage comp  = thing.TryGetComp <CompHediffStorage>();

            if (comp != null)
            {
                comp.parts.Clear();
                comp.hediffs.Clear();

                foreach (Hediff hediff in pawn.health.hediffSet.hediffs.Where(x => HealthHelper.IsParent(part, x.Part)))
                {
                    comp.parts.Add(hediff.Part.def);
                    comp.hediffs.Add(hediff);
                }
            }

            __result = thing;
            return(false);
        }
示例#5
0
 /// <summary>
 /// Start method for game healper.
 /// </summary>
 void Start()
 {
     _currentTime   = 0;
     Time.timeScale = 1;
     SpawnMonster();
     _healthHelper = FindObjectOfType <HealthHelper>();
 }
    // Use this for initialization
    void Start()
    {
        _healthHelper = GetComponent <HealthHelper>();

        _navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>();
        _anim         = GetComponent <Animator>();
    }
示例#7
0
    void launchHealthhelper(float direction)
    {
        GameObject obj    = GameObject.Instantiate(this.healthhelper);
        Vector3    my_pos = this.transform.position;

        my_pos.y = this.GetComponent <BoxCollider2D>().bounds.center.y;
        HealthHelper healthhelper = obj.GetComponent <HealthHelper>();

        healthhelper.transform.position = my_pos;
        healthhelper.launch(direction);
    }
示例#8
0
 // Update is called once per frame
 private void Update()
 {
     try
     {
         _healthHelper = GameObject.FindObjectOfType <HealthHelper>();
     }
     catch (System.Exception)
     {
         return;
     }
 }
示例#9
0
    void Awake()
    {
        // Берем индекс слоя Shootable
        shootableMask = LayerMask.GetMask("Shootable");

        gunParticles = GetComponent <ParticleSystem>();
        gunLine      = GetComponent <LineRenderer>();
        gunAudio     = GetComponent <AudioSource>();
        gunLight     = GetComponent <Light>();


        _parent = GetComponentInParent <HealthHelper>();
    }
示例#10
0
    private void SetMonsterStats(MonsterPerson monsterPerson, Language currentLanguage)
    {
        var hpStat = monsterPerson.GetModule <ISurvivalModule>().Stats.SingleOrDefault(x => x.Type == SurvivalStatType.Health);

        if (hpStat == null)
        {
            return;
        }

        var monsterHealthStateKey = HealthHelper.GetHealthStateKey(hpStat);
        var monsterHealthState    = StaticPhrases.GetValue($"state-hp-{monsterHealthStateKey}", currentLanguage);

        MonsterHpText.text = monsterHealthState;
    }
示例#11
0
        public async Task <IActionResult> SaveRecords(HealthViewModel healthViewModel)
        {
            if (ModelState.IsValid)
            {
                HealthHelper healthHelper = new HealthHelper(_dbContextOptions);
                await healthHelper.SaveRecords(healthViewModel);

                ViewBag.msg = "Health details saved";
                return(LocalRedirect("/Health/Health"));
            }
            else
            {
                return(View());
            }
        }
示例#12
0
    public void GetDamage(int damage, HealthHelper killer)
    {
        if (Dead)
        {
            return;
        }

        Health -= damage;

        if (Health <= 0)
        {
            Dead = true;

            // GetComponent<Animator>().SetBool("Dead", true);
        }
    }
示例#13
0
        /// <summary>
        /// Update is called once per frame.
        /// </summary>
        void Update()
        {
            if (_healthHelper == null)
            {
                _healthHelper = GameObject.FindObjectOfType <HealthHelper>();
            }
            else
            {
                transform.position = Vector2.MoveTowards(transform.position,
                                                         _healthHelper.transform.position,
                                                         Time.deltaTime * 10f);

                if (Vector2.Distance(transform.position, _healthHelper.transform.position) < 0.1f)
                {
                    _healthHelper.GetHit(Damage);
                    Destroy(gameObject);
                }
            }
        }
示例#14
0
    public void GetDamage(int damage, HealthHelper killer)
    {
        print("call it");
        if (Dead)
        {
            return;
        }

        Health -= damage;

        if (Health <= 0)
        {
            Dead          = true;
            killer.Kills += 1;
            GetComponentInChildren <PlayerShooting>().Drop();
            GetComponent <Animator>().SetBool("Dead", true);
            Destroy(_uIHealthBarHelper.gameObject);
        }
    }
示例#15
0
 // Use this for initialization
 void Start()
 {
     _navMeshAgent = GetComponent <NavMeshAgent>();
     _healthHelper = GetComponent <HealthHelper>();
     _nPCHelper    = GetComponent <NPCHelper2>();
 }
示例#16
0
        public async Task <IActionResult> Dashboard()
        {
            HealthHelper healthHelper = new HealthHelper(_dbContextOptions);
            var          list         = await healthHelper.GetAll();

            var        sortedList = list.OrderBy(x => x.Age).ToList();
            List <int> commonAge  = new List <int>();
            var        ages       = sortedList.Select(x => x.Age).Distinct();
            var        totalCount = new Dictionary <int, int>();

            foreach (var age in ages)
            {
                commonAge.Add(sortedList.Count(x => x.Age == age));
            }
            var commonagelist = commonAge;
            var diabetic = new Dictionary <int, int>();
            int i = 0, j = 0, k = 0;
            int set1 = 0, set2 = 0, set3 = 0;

            foreach (var healthList in sortedList)
            {
                if (healthList.Age < 31)
                {
                    if (healthList.Diabetic == true)
                    {
                        i += 1;
                    }
                    set1 += 1;
                }
                else if (healthList.Age < 61)
                {
                    if (healthList.Diabetic == true)
                    {
                        j += 1;
                    }
                    set2 += 1;
                }
                else
                {
                    if (healthList.Diabetic == true)
                    {
                        k += 1;
                    }
                    set3 += 1;
                }
            }
            totalCount.Add(1, set1);
            totalCount.Add(2, set2);
            totalCount.Add(3, set3);
            diabetic.Add(1, i);
            diabetic.Add(2, j);
            diabetic.Add(3, k);

            var percentage = new List <int>();

            foreach (var index in Enumerable.Range(1, 3))
            {
                percentage.Add((diabetic.GetValueOrDefault(index) * 100) / totalCount.GetValueOrDefault(index));
            }
            ViewBag.AGES          = ages;
            ViewBag.COMMONAGELIST = commonagelist;
            ViewBag.PERCENTAGE    = percentage;
            return(View());
        }
示例#17
0
 // Start is called before the first frame update
 void Start()
 {
     _healthHelper = GetComponent <HealthHelper>();
     _gun          = GetComponentInChildren <PlayerShooting>();
     _target       = GameObject.Find("Player").GetComponent <PlayerHealthHelper>();
 }
示例#18
0
 // Use this for initialization
 void Start()
 {
     _healthHelper = GetComponent <HealthHelper>();
     StartCoroutine(Timer());
     _gun = GetComponentInChildren <PlayerShooting>();
 }
示例#19
0
 // Use this for initialization
 void Start()
 {
     _healthHelper = GetComponent <HealthHelper>();
     _animator     = GetComponent <Animator>();
 }