Beispiel #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Hp != 0)
            {
                hash ^= Hp.GetHashCode();
            }
            if (Mp != 0)
            {
                hash ^= Mp.GetHashCode();
            }
            if (Attack != 0)
            {
                hash ^= Attack.GetHashCode();
            }
            if (Defend != 0)
            {
                hash ^= Defend.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Hp != 0)
            {
                hash ^= Hp.GetHashCode();
            }
            if (Attack != 0)
            {
                hash ^= Attack.GetHashCode();
            }
            hash ^= infos_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #3
0
        private void draw_leader_data(SpriteBatch sprite_batch, Vector2 offset)
        {
            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            // Team leader
            // Background
            UnitBg.draw(sprite_batch, offset);
            // Labels
            Lv_Label.draw(sprite_batch, offset);
            Hp_Label.draw(sprite_batch, offset);
            Hp_Slash.draw(sprite_batch, offset);
            RatingLabel.draw(sprite_batch, offset);
            sprite_batch.End();
            // Data
            Face.draw(sprite_batch, offset);

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            Leader_Name.draw(sprite_batch, offset);
            Lvl.draw(sprite_batch, offset);
            Hp.draw(sprite_batch, offset);
            Hp_Max.draw(sprite_batch, offset);
            Rating.draw(sprite_batch, offset);
            LeaderWeapon.draw(sprite_batch, offset);
            Map_Sprite.draw(sprite_batch, offset);
            sprite_batch.End();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            double a = 0, b = 300;
            int    n = 1, m = 1;
            bool   flag = true;

            while (flag)
            {
                string output = "\n", vih, rezult = "";
                Console.Write("Введіть кількість рядків:");
                n = Convert.ToInt32(Console.ReadLine());
                Console.Write("Введіть кількість стоібців:");
                m = Convert.ToInt32(Console.ReadLine());

                double[,] arr = new double[n, m];
                Hp.Gen(arr, n, m, a, b);
                Hp.Printer(arr, n, m, ref output);
                Hp.Maxpos(arr, n, m, ref rezult);

                Console.WriteLine(output);
                Console.WriteLine(rezult);

                Console.Write("Бажаєте повторити?(Y/N):");
                vih = Console.ReadLine();
                if (vih != "y" && vih != "Y")
                {
                    flag = false;
                }
            }
        }
Beispiel #5
0
 public void CheckLose()
 {
     Hp.Check(Times);
     Mood.Check(Times);
     Food.Check(Times);
     Valutes.Check(Times);
 }
Beispiel #6
0
        private void Load()
        {
            foreach (string key in mobImages.Keys)
            {
                box.Children.Add(mobImages[key]);
            }
            hpTxt = new TextBlock()
            {
                Text          = Hp.ToString() + "/" + HpMax.ToString(),
                TextAlignment = Windows.UI.Xaml.TextAlignment.Center,
                FontSize      = 12,
                FontStyle     = Windows.UI.Text.FontStyle.Italic
            };
            box.Children.Add(hpTxt);
            Canvas.SetTop(hpTxt, -50);
            double prop = 0.6;

            Canvas.SetLeft(mobImages["armsd0"], 4 * prop); Canvas.SetTop(mobImages["armsd0"], 18 * prop);
            Canvas.SetLeft(mobImages["armsd1"], -21 * prop); Canvas.SetTop(mobImages["armsd1"], 49 * prop);
            Canvas.SetLeft(mobImages["legsd1"], 32 * prop); Canvas.SetTop(mobImages["legsd1"], 76 * prop);
            Canvas.SetLeft(mobImages["legsd0"], 20 * prop); Canvas.SetTop(mobImages["legsd0"], 45 * prop);
            Canvas.SetLeft(mobImages["body"], 8 * prop); Canvas.SetTop(mobImages["body"], -10 * prop);
            Canvas.SetLeft(mobImages["head"], -16 * prop); Canvas.SetTop(mobImages["head"], -34 * prop);
            Canvas.SetLeft(mobImages["legse1"], 64 * prop); Canvas.SetTop(mobImages["legse1"], 75 * prop);
            Canvas.SetLeft(mobImages["legse0"], 55 * prop); Canvas.SetTop(mobImages["legse0"], 47 * prop);
            Canvas.SetLeft(mobImages["armse0"], 33 * prop); Canvas.SetTop(mobImages["armse0"], 18 * prop);
            Canvas.SetLeft(mobImages["armse1"], 12 * prop); Canvas.SetTop(mobImages["armse1"], 50 * prop);

            Attacked += UpdateHpText;
        }//monta as imagens na box do Mob
Beispiel #7
0
    public void LoadStatus(SaveData LoadData)
    {
        Name      = new Name(LoadData.Name);
        Lv        = new Lv(LoadData.Lv);
        Hp        = new Hp(LoadData.MaxHp, LoadData.CurrentHp);
        Mp        = new Mp(LoadData.MaxMp, LoadData.CurrentMp);
        Str       = new Str(LoadData.Str);
        Vit       = new Vit(LoadData.Vit);
        Dex       = new Dex(LoadData.Dex);
        Int       = new Int(LoadData.Int);
        Exp       = new Exp(LoadData.NextExp, LoadData.CurrentExp);
        MoveSpeed = new MoveSpeed(3, 1);

        Direction = new Direction(Animator);

        ChargeSkill = new SwordChargeAtack();
        NormalAtack = new SwordNomalAtack();
        Skill       = NormalAtack;
        Charge      = GameObject.transform.Find("tame").GetComponent <Charge>();
        Weapon      = (GameObject)Resources.Load("prefab/Weapon/Sword");
        Equip       = new Equip();

        Equip.Weapon(LoadData.EquipWeapon);
        Equip.Head(LoadData.EquipHead);
        Equip.Body(LoadData.EquipBody);
        Equip.Hand(LoadData.EquipHand);
        Equip.Foot(LoadData.EquipFoot);
        Equip.Accessory(LoadData.EquipAccessory);
    }
Beispiel #8
0
 void Start()
 {
     hp        = gameObject.GetComponent <Hp>();
     particle  = gameObject.GetComponent <ParticleSystem>();
     lastScene = GameObject.Find("LastScene");
     lastScene.SetActive(false);
 }
Beispiel #9
0
        protected virtual void draw_hp(SpriteBatch sprite_batch, Vector2 draw_offset)
        {
            Vector2 offset = draw_vector() - draw_offset;

            Hp_Label.draw(sprite_batch, -(loc + offset));
            Hp.draw(sprite_batch, -(loc + offset));
        }
Beispiel #10
0
    void OnChildTriggerEnter(Collider myCol)
    {
        //print ("on trigger");
        if (myCol.gameObject.GetComponent <Health>())
        {
            //print ("found helath component");
            Health dealtarget = myCol.gameObject.GetComponent <Health>();
            dealtarget.Damage(damage, transform);
        }

        Hp leDealTarget = null;

        if (myCol.GetComponent <Hp> ())
        {
            leDealTarget = myCol.GetComponent <Hp> ();
        }
        else if (myCol.GetComponentInChildren <Hp> ())
        {
            leDealTarget = myCol.GetComponentInChildren <Hp> ();
        }
        else if (myCol.GetComponentInParent <Hp> ())
        {
            leDealTarget = myCol.GetComponentInParent <Hp> ();
        }
        if (leDealTarget != null)
        {
            leDealTarget.Damage((int)((float)damage * friendlyFireMultiplier));
        }
    }
Beispiel #11
0
        public int RollHealth()
        {
            int dice = 0;

            if (Hp != "0")
            {
                string[] ret = Hp.Split('(', 'd', '+', '-');
                for (int i = 0; i < int.Parse(ret[1]); i++)
                {
                    dice += DiceRoller.randInt(1, int.Parse((ret[2]).TrimEnd(')')));
                }
                if (ret.Length == 4)
                {
                    if (Hp.Contains("+"))
                    {
                        dice += int.Parse((ret[3].TrimEnd(')')));
                    }
                    else if (Hp.Contains("-"))
                    {
                        dice -= int.Parse((ret[3].TrimEnd(')')));
                    }
                }
            }
            return(dice);
        }
Beispiel #12
0
    public void UpdatePlayerInfo()
    {
        string filePath = Application.persistentDataPath + "/Player.xml";

        if (File.Exists(filePath))
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(filePath);

            XmlNodeList playerNodeList = xmlDoc.SelectSingleNode("Player").ChildNodes;
            //遍历Player结点下所有子节点
            foreach (XmlElement xe in playerNodeList)
            {
                switch (xe.Name)
                {
                case "LevelLayer":
                    xe.InnerText = LayerCount.ToString();
                    break;

                case "Hp":
                    xe.InnerText = Hp.ToString();
                    break;

                case "ShootLevel":
                    xe.InnerText = ShootLevel.ToString();
                    break;

                case "SpeedLevel":
                    xe.InnerText = SpeedLevel.ToString();
                    break;

                case "BulletLevel":
                    xe.InnerText = BulletLevel.ToString();
                    break;

                case "LightLevel":
                    xe.InnerText = BulletLevel.ToString();
                    break;

                case "Speed":
                    xe.InnerText = Speed.ToString();
                    break;

                case "ShootTimer":
                    xe.InnerText = ShootTimer.ToString();
                    break;

                case "Money":
                    xe.InnerText = Money.ToString();
                    break;

                case "SkillIcon":
                    xe.InnerText = skillIcon.ToString();
                    break;
                }
            }
            xmlDoc.Save(filePath);
        }
    }
    protected virtual void Start()
    {
        player = GetLinkedObject("player_obj");
        health = GetLinkedObject("health_obj").GetComponent <Hp>();

        stamina       = GetLinkedObject("stamina_obj").GetComponent <Stamina>();
        stamina_img   = stamina.GetComponent <CompImage>();
        leftamina_img = GetLinkedObject("leftamina_bar").GetComponent <CompImage>();

        mana          = GetLinkedObject("mana_obj").GetComponent <Mana>();
        mana_img      = mana.GetComponent <CompImage>();
        left_mana_img = GetLinkedObject("leftmana_bar").GetComponent <CompImage>();

        audio    = player.GetComponent <CompAudio>();
        movement = player.GetComponent <MovementController>();

        anim_controller = GetComponent <CompAnimation>();
        damage_feedback = player.GetComponent <DamageFeedback>();

        characters_manager = player.GetComponent <CharactersManager>();
        enemy_manager      = GetLinkedObject("player_enemies_manager").GetComponent <EnemiesManager>();

        play_breathing_audio      = false;
        currently_playing_b_audio = false;
        force_audio = false;
    }
Beispiel #14
0
    public List <string> MakeListToItemInfo()
    {
        List <string> list = new List <string>();

        list.Add(Class);
        list.Add("Price " + Price.ToString());

        if (Hp != 0)
        {
            list.Add("+ HP " + Hp.ToString());
        }
        if (Attack != 0)
        {
            list.Add("+ Attack " + Attack.ToString());
        }
        if (Defense != 0)
        {
            list.Add("+ Defense " + Defense.ToString());
        }
        if (MoveSpeed != 0)
        {
            list.Add("+ Move Speed " + MoveSpeed.ToString());
        }
        if (AttackSpeed != 0)
        {
            list.Add("+ Attack Speed " + AttackSpeed.ToString());
        }

        return(list);
    }
Beispiel #15
0
    private void Awake()
    {
        //barImage = transform.Find("bar").GetComponent<Image>();
        barRawImage = transform.Find("barMask").Find("bar").GetComponent <RawImage>();

        hp = new Hp();
    }
Beispiel #16
0
 // Start is called before the first frame update
 void Start()
 {
     print("test");
     hpbar          = gameObject.GetComponent <Slider>();
     instance       = this;
     hpbar.maxValue = _playerHp;
     hpbar.value    = _playerHp;
 }
Beispiel #17
0
    void Start()
    {
        hp = GetComponent <Hp>();

        hp.OnHpChangeMinusEvent.AddListener(AttackNotification);
        hp.OnHpChangeMinusEvent.AddListener(AttackDebug);
        hp.OnHpDieEvent.AddListener(HomeDie);
    }
Beispiel #18
0
 protected void Start()
 {
     Hp = new Hp(startMaxHp, 0, startMaxHp);
     hpManager.CurHealth    = Hp;
     Hp.OnValueChangeToMin += Hp_OnValueChangeToMin;
     Hp.OnHpTaken          += Hp_OnHpTaken;
     hpManager.Refresh();
 }
Beispiel #19
0
 public override void TakeDamage(Damage TakeDamage)
 {
     Hp.TakeDamage(TakeDamage.Physical + TakeDamage.Magic);
     if (!isAlive())
     {
         Die();
     }
 }
Beispiel #20
0
        public override string ToString()
        {
            string s1 = string.Format("X={0}, H={1}, Hp={2}", X.Show(), H.Show(), Hp.Show());
            string s2 = string.Format(", Range={0}", Tools.Show(Range));
            string s3 = string.Format(", HigherSide={0}, IncludeSoln={1}", HigherSide, IncludeSoln);

            return(s1 + s2 + s3);
        }
Beispiel #21
0
    public override void Start()
    {
        Hp hp = target.gameObject.GetComponent <Hp>();

        if (hp != null)
        {
            this.hp = hp;
        }
    }
Beispiel #22
0
        static void Main(string[] args)
        {
            Laptop hp1   = new Hp();
            Laptop dell1 = new Dell();

            hp1.TurnOn();

            dell1.TurnOn();
        }
Beispiel #23
0
 protected void GetComponentMethod()
 {
     rg          = this.GetComponent <Rigidbody>();
     FlightM     = this.GetComponent <ReFlightMode>();
     FireBulletS = this.GetComponent <FireBullet>();
     Hppoint     = GameObject.Find("DEMO_GM").GetComponent <Hp>();
     CrossDot    = GameObject.Find("Dot").GetComponent <CrossHair>();
     ForceShield = GameObject.Find("PlayerShield").GetComponent <ForceShield>();
 }
Beispiel #24
0
 void Start()
 {
     if (gameObject.name != "Player")
     {
         audioSource = GetComponent <AudioSource>();
     }
     hp = GetComponent <Hp>();
     audioSource.clip = hit;
 }
Beispiel #25
0
		public Slime() {
			Hp.Max = 20;
			Hp.Set();
			level = 1;
			feed_Exp = 10;
			speed = 200;
			damage = 2;
			name = new char[] "슬라임";
	}
Beispiel #26
0
    // Use this for initialization
    void Start()
    {
        agent  = GetComponent <NavMeshAgent>();
        hp     = GetComponent <Hp>();
        attack = GetComponent <Attack>();

        agent.SetDestination(target.transform.position);
        hp.OnHpDieEvent.AddListener(Die);
    }
Beispiel #27
0
    protected override void Awake()
    {
        base.Awake();
        SetPistolVisible(false);
        inputActions = new InputActions();
        inputActions.Player.Rotation.performed += ctx => lookPosition = ctx.ReadValue <Vector2>();

        Hp = new Hp(startMaxHp, 0, startMaxHp);
    }
Beispiel #28
0
    // Use this for initialization
    void Start()
    {
        attack = GetComponent <Attack>();
        hp     = GetComponent <Hp>();


        target = null;
        mode   = TowerMode.DefaultAttack;
    }
Beispiel #29
0
 private void Start()
 {
     maxHp = GetComponent <MaxHp>();
     hp    = GetComponent <Hp>();
     if (slider != null && maxHp != null && hp != null)
     {
         slider.maxValue = maxHp.GetValue();
         slider.value    = hp.GetValue();
     }
 }
Beispiel #30
0
        private void Update()
        {
            _hpText.text    = Hp.ToString();
            _coinsText.text = Coins.ToString();

            if (Hp <= 0 && SceneManager.GetActiveScene() != SceneManager.GetSceneByBuildIndex(3))
            {
                LoseGame();
            }
        }
Beispiel #31
0
        public void SetHp(Hp hp)
        {
            if (hp > MaxHp)
            {
                Debug.LogWarning("trying to set hp bigger than max value.");
                hp = MaxHp;
            }

            if (MaxHp == 0)
            {
                Debug.LogError("MaxHp is zero.");
                return;
            }

            SetBarScale((int) hp/(float) (int) MaxHp);
            RefreshMark();
        }
Beispiel #32
0
 public virtual void Heal(Hp val)
 {
     if (IsDead)
     {
         Debug.LogWarning("heal but dead.");
         return;
     }
     Hp += (int)val;
 }
Beispiel #33
0
 public void SetHpForced(Hp val)
 {
     var oldHp = _hp;
     _hp = val;
     AfterHpChanged(oldHp);
 }
Beispiel #34
0
 protected virtual void AfterHpChanged(Hp old)
 {
 }
 /// <summary>
 /// Loads the scripts required for this function.
 /// </summary>
 protected void Awake()
 {
     hp = GetComponent<Hp>();
 }
Beispiel #36
0
 public Damage(Hp value)
 {
     Value = value;
     Element = Element.Normal;
 }
Beispiel #37
0
 public Damage(Hp value, Element element)
 {
     Value = value;
     Element = element;
 }