Наследование: MonoBehaviour
Пример #1
0
        private void _statsList(DisplayStats _data)
        {
            CharStatData localStats = World.Instance.MainPlayer.ActiveCharacter.Stats;

            if (_data.IsStatsData)
            {
                localStats.statpoints = _data.StatPoints;
            }
            else
            {
                World.Instance.MainPlayer.ActiveCharacter.Class = _data.Class;
            }
            localStats.SetStr(_data.Str);
            localStats.SetInt(_data.Int);
            localStats.SetWis(_data.Wis);
            localStats.SetAgi(_data.Agi);
            localStats.SetCon(_data.Con);
            localStats.SetCha(_data.Cha);
            localStats.SetMaxHP(_data.MaxHP);
            localStats.SetMaxTP(_data.MaxTP);
            localStats.SetSP(_data.MaxSP);
            localStats.SetMaxSP(_data.MaxSP);
            World.Instance.MainPlayer.ActiveCharacter.MaxWeight = _data.MaxWeight;
            localStats.SetMinDam(_data.MinDam);
            localStats.SetMaxDam(_data.MaxDam);
            localStats.SetAccuracy(_data.Accuracy);
            localStats.SetEvade(_data.Evade);
            localStats.SetArmor(_data.Armor);
            m_game.Hud.RefreshStats();
        }
 void Update()
 {
     _generatorsLayer.SetActive(!_isInventoryVisible);
     _inventoryLayer.SetActive(_isInventoryVisible);
     if (_isInventoryVisible)
     {
         for (int y = 0; y < 8; y++)
         {
             for (int x = 0; x < 12; x++)
             {
                 if (_index < _inventoryInstance.elements.Count)
                 {
                     GameObject    gameObject = new GameObject("#" + _inventoryInstance.elements[_index].id.ToString());
                     RectTransform rect       = gameObject.AddComponent <RectTransform>();
                     Image         image      = gameObject.AddComponent <Image>();
                     DisplayStats  dispStat   = gameObject.AddComponent <DisplayStats>();
                     _gameObjects.Add(gameObject);
                     rect.transform.SetParent(_inventoryLayer.transform);
                     rect.anchorMin        = new Vector2(0, 1);
                     rect.anchorMax        = new Vector2(0, 1);
                     rect.pivot            = new Vector2(0, 1);
                     rect.anchoredPosition = new Vector2(x * 60, -y * 60);
                     rect.sizeDelta        = new Vector2(50, 50);
                     rect.localScale       = Vector3.one;
                     image.sprite          = _inventoryInstance.elements[_index].elementDisplay;
                     _index++;
                 }
             }
         }
     }
 }
 internal void UpdateFrameTiming()
 {
     if (DisplayStats != null)
     {
         DisplayStats.UpdateFrameTiming();
     }
 }
Пример #4
0
        public void DisplayRoundStats()
        {
            ICharacter hero           = new Hero("Bob", 100, 100, 50);
            ICharacter monster        = new Monster("Orc", 100, 50);
            IDisplay   statsDisplayer = new DisplayStats();

            Assert.IsTrue(!String.IsNullOrEmpty(statsDisplayer.Display(hero)));
            Assert.IsTrue(!String.IsNullOrEmpty(statsDisplayer.Display(monster)));
        }
Пример #5
0
 void Start()
 {
     audioManager          = AudioManager.instance;
     player                = Player.instance;
     controller            = GameController.instance;
     pooler                = PoolerManager.instance; // Pooler Manager
     player.ammo[ammoType] = initialAmmo;
     DisplayStats.UpdateRocketAmmo(initialAmmo);
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     playerHealth = GetComponent <Health>();
     rb           = GetComponent <Rigidbody2D>();
     screenBottom = Camera.main.ScreenToWorldPoint(new Vector2(0, 0));
     screenTop    = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height));
     shipHeight   = transform.localScale.y / 2;
     shipWidth    = transform.localScale.x / 2;
     //controllerCommunicator = controller.GetComponent<GameController>();
     DisplayStats.UpdateHealth();
 }
Пример #7
0
 protected void Init()
 {
     tiles        = GameObject.FindGameObjectsWithTag("tile");
     displayStats = GetComponent <DisplayStats>();
     moveRange    = displayStats.stats.Movement;
     halfHeight   = GetComponentInChildren <Collider>().bounds.extents.y;
     if (displayStats == null)
     {
         Debug.LogWarning("NO STATS ASSIGNED TO " + this.gameObject.name);
     }
     unitAttack = GetComponent <UnitAttack>();
     TurnManager.AddUnit(this);
 }
Пример #8
0
 private void OnTriggerEnter2D(Collider2D coll)
 {
     //Debug.Log(coll.gameObject.tag);
     if (coll.gameObject.tag == "Enemy" && !shieldActive)
     {
         playerHealth.TakeDamage(1);
         DisplayStats.UpdateHealth();
         if (playerHealth.healthPoints > 0)
         {
             StartCoroutine(SetShield(shieldDuration));
         }
         if (playerHealth.healthPoints <= 0)
         {
             controllerCommunicator.isDead = true;
             //controllerCommunicator.PlayerCrash();
             playerHealth.Died();
         }
     }
 }
Пример #9
0
    void Update()
    {
        if (controller.isPaused)
        {
            return;
        }
        if (player.ammo[ammoType] > 0 && Input.GetKeyDown(rocket))
        {
            if (Time.time > shootTime + cooldown)
            {
                shootTime = Time.time;

                GameObject myRocket = pooler.Spawn("PRocket", transform.position, Quaternion.identity);                 // Pooling System to create or reuse a rocket

                myRocket.GetComponent <Projectile>().parent = transform.parent.gameObject;
                myRocket.GetComponent <Rigidbody2D>().AddForce(initForce, ForceMode2D.Impulse);
                audioManager.Play("RocketShoot");

                player.ammo[ammoType]--;
                DisplayStats.UpdateRocketAmmo(player.ammo[ammoType]);
            }
        }
    }
Пример #10
0
 void Start()
 {
     displayStats = this;
 }
Пример #11
0
 public void AddAmmo(int type, int amount)
 {
     ammo[type] += amount;
     DisplayStats.UpdateRocketAmmo(ammo[1]);
 }
Пример #12
0
 public void Heal(int amount)
 {
     playerHealth.Heal(amount);
     DisplayStats.UpdateHealth();
 }