Ejemplo n.º 1
0
    public int endReward(PlayerStats tmpPS, string str, bool winGame)
    {
        int   rewardValue = 0;
        float summary     = 0;

        if (monsterExist(str))
        {
            ms      = monster.GetComponent <MonsterStats>();
            summary = tmpPS.getCurrentHP() + ms.getHP();
        }
        else
        {
            summary = tmpPS.getCurrentHP();
        }
        if (winGame)
        {
            while (summary > 0)
            {
                rewardValue++;
                summary -= 10;
            }
        }
        else
        {
            while (summary > 0)
            {
                rewardValue--;
                summary -= 10;
            }
        }
        return(rewardValue);
    }
Ejemplo n.º 2
0
 void Start()
 {
     totalSpeed = moveSpeed;
     mStats     = gameObject.GetComponent <MonsterStats>();
     state      = gameObject.GetComponent <MonsterState>();
     headOrigin = gameObject.transform.GetChild(0).gameObject;
 }
Ejemplo n.º 3
0
        protected static MonsterStats GetAndApplyStatsFromData(string monsterType, Difficulties difficulty)
        {
            var random = new Random((int)System.DateTime.UtcNow.Ticks);

            var data = GetDataFromJson(monsterType);

            var stats = new MonsterStats();

            stats[MonsterStatTypes.DUNGEON_LEVEL_MIN] = data.DungeonLevelMin;
            stats[MonsterStatTypes.DUNGEON_LEVEL_MAX] = data.DungeonLevelMax;
            stats[MonsterStatTypes.MONSTER_LEVEL]     = data.MonsterLevel;

            var minHealth = data.HealthRange[difficulty][0];
            var maxHealth = data.HealthRange[difficulty][1];

            // System.Console.WriteLine($"Min: {minHealth}, Max: {maxHealth}");
            stats[MonsterStatTypes.LIFE] = random.Next(minHealth, maxHealth + 1);

            stats[MonsterStatTypes.ARMOUR_CLASS]     = data.ArmourClass[difficulty];
            stats[MonsterStatTypes.TO_HIT]           = data.ToHit[difficulty];
            stats[MonsterStatTypes.DAMAGE_MIN]       = data.DamageRange[difficulty][0];
            stats[MonsterStatTypes.DAMAGE_MAX]       = data.DamageRange[difficulty][1];
            stats[MonsterStatTypes.MAGIC_RESIST]     = data.MagicResistance[difficulty];
            stats[MonsterStatTypes.FIRE_RESIST]      = data.FireResistance[difficulty];
            stats[MonsterStatTypes.LIGHTNING_RESIST] = data.LightningResistance[difficulty];
            stats[MonsterStatTypes.BASE_EXP]         = data.BaseExperience[difficulty];

            return(stats);
        }
        public void StartFighting(World world)
        {
            var          playerPos = world.Get <PlayerPosition>();
            var          monsters  = world.Get <MonsterMoveController[]>();
            MonsterStats monster   = null;

            foreach (var monsterMove in monsters)
            {
                if (playerPos.NumberOfArrayPlayerIsIn == monsterMove.MonsterPosition.NumberOfArrayMonsterIsIn)
                {
                    monster = monsterMove.MonsterStats;
                    break;
                }
            }

            if (monster == null)
            {
                MoveMessages message = new MoveMessages(world);
                message.NoMonsterToFightMessage();
                world.WrongDirectionCount++;
            }
            else
            {
                PlayerStats player = world.Get <PlayerStats>();
                player.InCombat  = true;
                monster.InCombat = true;
                CombatHandler handler = world.Get <CombatHandler>();
                handler.ExchangeBlowsTillDeath(monster, player);
            }
        }
Ejemplo n.º 5
0
 void Start()
 {
     bullet = (GameObject)Resources.Load("Prefabs/BigEnemyBullet");
     //player = GameObject.FindGameObjectWithTag("Player");
     stats = GetComponent <MonsterStats>();
     anim  = GetComponent <Animator>();
 }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit(
            int id,
            [Bind("ID,Stamina,Strength,Agility,Dexterity," +
                  "Luck,HitPoints,AttackMin,Attack,AttackMax,Armor," +
                  "Block,Dodge,Speed,CritChance,Accuracy")] MonsterStats monsterStats)
        {
            if (id != monsterStats.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(monsterStats);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MonsterStatsExists(monsterStats.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(monsterStats));
        }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     stats  = gameObject.GetComponent <MonsterStats>();
     speed  = stats.speed;
     player = GameObject.FindWithTag("Player");
     anim   = GetComponent <Animator>();
 }
Ejemplo n.º 8
0
 void Start()
 {
     bullet          = (GameObject)Resources.Load("Prefabs/BigEnemyBullet3");
     bulletBomb      = (GameObject)Resources.Load("Prefabs/EnemyBulletBomb");
     bulletSkull     = (GameObject)Resources.Load("Prefabs/SkullBullet");
     bulletSprinkler = (GameObject)Resources.Load("Prefabs/EnemyBulletSprinkler2");
     laser           = (GameObject)Resources.Load("Prefabs/EnemyLaserPreparing");
     spawnPointNW    = GameObject.Find("spawnPointNorthWest");
     spawnPointNE    = GameObject.Find("spawnPointNorthEast");
     spawnPointSW    = GameObject.Find("spawnPointSouthWest");
     spawnPointSE    = GameObject.Find("spawnPointSouthEast");
     spawnPointN     = GameObject.Find("spawnPointNorth");
     spawnPointE     = GameObject.Find("spawnPointEast");
     spawnPointS     = GameObject.Find("spawnPointSouth");
     spawnPointW     = GameObject.Find("spawnPointWest");
     stats           = GetComponent <MonsterStats>();
     player          = GameObject.FindGameObjectWithTag("Player");
     BHand1_script   = BHand1.GetComponent <Hand>();
     BHand2_script   = BHand2.GetComponent <Hand>();
     MHand1_script   = MHand1.GetComponent <Hand>();
     MHand2_script   = MHand2.GetComponent <Hand>();
     THand1_script   = THand1.GetComponent <Hand>();
     THand2_script   = THand2.GetComponent <Hand>();
     anim            = Eye.GetComponent <Animator>();
     animationTimer  = Random.Range(2.00f, 8.00f);
 }
Ejemplo n.º 9
0
        public MonsterMoveController[] CreateMonsters(World world, MapLevelDetails map)
        {
            MonsterPosition monster1      = new MonsterPosition(map, world);
            MonsterStats    statsMonster1 = new MonsterStats("rabbit");

            monster1.MoveTo(151, statsMonster1);
            MonsterPosition monster2      = new MonsterPosition(map, world);
            MonsterStats    statsMonster2 = new MonsterStats("rabbit");

            monster2.MoveTo(152, statsMonster2);
            MonsterPosition monster3      = new MonsterPosition(map, world);
            MonsterStats    statsMonster3 = new MonsterStats("rabbit");

            monster3.MoveTo(177, statsMonster3);
            MonsterPosition monster4      = new MonsterPosition(map, world);
            MonsterStats    statsMonster4 = new MonsterStats("cat");

            monster4.MoveTo(60, statsMonster4);
            MonsterPosition monster5      = new MonsterPosition(map, world);
            MonsterStats    statsMonster5 = new MonsterStats("cat");

            monster5.MoveTo(36, statsMonster5);
            MonsterPosition monster6      = new MonsterPosition(map, world);
            MonsterStats    statsMonster6 = new MonsterStats("cat");

            monster6.MoveTo(37, statsMonster6);
            MonsterMoveController[] monsters = new MonsterMoveController[6];
            monsters[0] = new MonsterMoveController(monster1, statsMonster1);
            monsters[1] = new MonsterMoveController(monster2, statsMonster2);
            monsters[2] = new MonsterMoveController(monster3, statsMonster3);
            monsters[3] = new MonsterMoveController(monster4, statsMonster4);
            monsters[4] = new MonsterMoveController(monster5, statsMonster5);
            monsters[5] = new MonsterMoveController(monster6, statsMonster6);
            return(monsters);
        }
Ejemplo n.º 10
0
        private void Spawn(MonsterStats monster)
        {
            //int spawnNumPerTime = Random.Range(1, 4);

            //for (int s = 0; s < spawnNumPerTime; s++) {
            //    //Pick monster type
            //    MonsterStats randomMonster = _monsterUnits[Random.Range(0, monsterLength)];

            //Pick start position
            int      randomX        = Random.Range(0, _entranceComponent.fullSize.x);
            TileNode randomTileNode = _entranceComponent.tilemapReader.nodes[randomX, _entranceComponent.fullSize.y - 1];

            GameObject monsterObject = PoolManager.instance.ReuseObject(VariableFlag.Pooling.MonsterID);

            if (monsterObject != null)
            {
                BaseStrategy strategy = _strategyMapper.GetStrategy(monster.strategy);

                MonsterUnit unit = monsterObject.GetComponent <MonsterUnit>();
                unit.transform.position = randomTileNode.WorldSpace;
                unit.SetUp(monster, strategy, _mapGrid, _mapHolder, _gameUnitManager.gameDamageManager);
                _gameUnitManager.AddUnit(unit);
            }
            //}
        }
Ejemplo n.º 11
0
    void Start()
    {
        monster     = gameObject.GetComponent <Monster>();
        search      = gameObject.GetComponent <SearchFood>();
        stats       = gameObject.GetComponent <MonsterStats>();
        fetch       = gameObject.GetComponent <Fetch>();
        boxing      = gameObject.GetComponent <Boxing>();
        audioSource = gameObject.GetComponent <AudioSource>();

        fetch.stats         = stats;
        fetch.state         = this;
        fetch.monster       = monster;
        search.monster      = monster;
        search.fetch        = fetch;
        search.state        = this;
        search.player       = GameObject.Find("Player").GetComponent <Valve.VR.InteractionSystem.Player>();
        stats.state         = this;
        stats.monster       = monster;
        boxing.monster      = monster;
        boxing.player       = monster.mainPlayer;
        boxing.obstacleMask = monster.ObstacleMask;
        boxing.stats        = stats;
        boxing.state        = this;

        stats.DisplayStats();

        Vector3 temphPos = hatchObject.transform.position;

        temphPos.y = monster.GroundLevel;
        gameObject.transform.position = temphPos;


        EventManager.instance.Fetching += OnFetching;
        EventManager.instance.Pointing += OnPointing;
    }
Ejemplo n.º 12
0
 void Start()
 {
     monsterStats  = enemyList.enemyList[Random.Range(0, enemyList.enemyList.Length)];
     currentHealth = monsterStats.health;
     maximumHealth = currentHealth;
     StartCoroutine(MovementLoop());
 }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     bullet = (GameObject)Resources.Load("Prefabs/EnemyBullet");
     stats  = gameObject.GetComponent <MonsterStats>();
     speed  = stats.speed;
     player = GameObject.FindWithTag("Player");
     anim   = GetComponent <Animator>();
 }
Ejemplo n.º 14
0
 private void Start()
 {
     monsterStats = GetComponent <MonsterStats>();
     monsterStats.UpgradeStats();
     life        *= monsterStats.constitution;
     speedMove   *= multiplierBonusSpeed * monsterStats.agility;
     powerAttack *= monsterStats.strength;
     pvMax        = life;
 }
Ejemplo n.º 15
0
 void Awake()
 {
     instance  = this;
     spawnList = GameObject.FindGameObjectWithTag("SpawnList").transform;
     for (int i = 0; i < spawnList.childCount; i++)
     {
         spawnPlaces.Add(spawnList.GetChild(i));
     }
 }
Ejemplo n.º 16
0
 public void ExchangeBlowsTillDeath(MonsterStats monsterStat, PlayerStats playerStats)
 {
     _player             = playerStats;
     _monster            = monsterStat;
     _startUpdate        = true;
     _howFastPlayerHits  = TimeSpan.FromSeconds(3 - (_player.Speed * 0.08));
     _howFastMonsterHits = TimeSpan.FromSeconds(3 - (_monster.Speed * 0.08));
     _messages.StartFightMessage(_monster.Name);
 }
Ejemplo n.º 17
0
    void Start()
    {
        currSpeed    = speed;
        animator     = GetComponent <Animator>();
        spr          = GetComponent <SpriteRenderer>();
        monsterStats = GetComponent <MonsterStats>();

        animator.SetInteger("State", 0);
    }
Ejemplo n.º 18
0
 void Start()
 {
     anim  = GetComponent <Animator>();
     stats = GetComponent <MonsterStats>();
     if (type == 1)
     {
         totalTime = timer = Random.Range(timer + 1, timer + 7.00f);
     }
 }
Ejemplo n.º 19
0
    private void Start()
    {
        forceText.color   = colorText;
        pvText.color      = colorText;
        vitesseText.color = colorText;

        monsterStats  = monsterEmpty.GetComponent <MonsterStats>();
        monsterSystem = monsterEmpty.GetComponent <MonsterSystem>();
    }
Ejemplo n.º 20
0
 void Start()
 {
     spell      = (GameObject)Resources.Load("Prefabs/Lightning");
     stats      = gameObject.GetComponent <MonsterStats>();
     speed      = stats.speed;
     player     = GameObject.FindWithTag("Player");
     spellTimer = Random.Range(1.0f, 4.0f);
     anim       = gameObject.GetComponent <Animator>();
 }
Ejemplo n.º 21
0
    // Use this for initialization
    void Start()
    {
        hasNotifiedPlayerOfDeath = false;

        stats        = GetComponent <MonsterStats> ();
        player       = GameObject.FindGameObjectWithTag("Player");
        animator     = GetComponent <Animator> ();
        agent        = GetComponent <NavMeshAgent> ();
        monsterAudio = GetComponent <AudioSource> ();
    }
Ejemplo n.º 22
0
 void Start()
 {
     bullet           = (GameObject)Resources.Load("Prefabs/EnemyBullet");
     stats            = gameObject.GetComponent <MonsterStats>();
     speed            = stats.speed;
     player           = GameObject.FindWithTag("Player");
     anim             = GetComponent <Animator>();
     originalPosition = transform.position.y;
     MoveRandomly();
 }
Ejemplo n.º 23
0
 public HealthPower(float maxHp, float hpMultiplierIncrementer, float hpMultiplier, float hpValueToMultiply, MonsterStats stats)
 {
     this.stats            = stats;
     this.maxHp            = maxHp;
     multiplierIncrementer = hpMultiplierIncrementer;
     multiplier            = hpMultiplier;
     valueToMultiply       = hpValueToMultiply;
     SetCurrentHp();
     FaintedStates = FaintedStates.ALIVE;
 }
Ejemplo n.º 24
0
 public void linkStats()
 {
     foreach (MonsterStats creature in GameObject.Find("Creature Dispatcher").GetComponent <CreatureDispatcher>().creatures)
     {
         if (creature.name == this.name)
         {
             stats = creature;
         }
     }
 }
Ejemplo n.º 25
0
    public void addDmg(int dmg, int dmgType, NetworkInstanceId killer)
    {
        MonsterStats monsterStats = this.transform.GetComponent <MonsterStats>();

        monsterStats.HP -= dmg - (dmg * (monsterStats.DEF[dmgType]) / 100);
        if (monsterStats.HP <= 0)
        {
            Death(killer);
        }
    }
Ejemplo n.º 26
0
 void Start()
 {
     tablet = GetComponent <Valve.VR.InteractionSystem.Tablet>();
     mStats = FindObjectOfType <MonsterStats>();
     if (!mStats)
     {
         Debug.LogWarning("No monster found in scene");
     }
     StartCoroutine("UpdateUIStats");
 }
Ejemplo n.º 27
0
 void Start()
 {
     bullet          = (GameObject)Resources.Load("Prefabs/BigEnemyBullet");
     bulletBomb      = (GameObject)Resources.Load("Prefabs/EnemyBulletBomb");
     bulletSprinkler = (GameObject)Resources.Load("Prefabs/EnemyBulletSprinkler");
     //originalPosition = transform.position;
     stats  = GetComponent <MonsterStats>();
     player = GameObject.FindGameObjectWithTag("Player");
     anim   = GetComponent <Animator>();
 }
Ejemplo n.º 28
0
 public void terrexAdd()
 {
     if (skillManagerCpu.getIsSummoned())
     {
         terrexExist         = true;
         terrexGO            = GameObject.FindGameObjectWithTag("Terrex");
         terrex              = terrexGO.GetComponent <MonsterStats>();
         button.interactable = true;
         skillManagerCpu.setIsSummoned(false);
     }
 }
Ejemplo n.º 29
0
 // Use this for initialization
 void Start()
 {
     summonTime  = 0f;
     controller  = GetComponent <SummonerController> ();
     isAttacking = false;
     player      = GameObject.FindGameObjectWithTag("Player");
     anim        = GetComponent <Animator> ();
     rigid       = GetComponent <Rigidbody> ();
     nav         = GetComponent <NavMeshAgent> ();
     stats       = GetComponent <MonsterStats> ();
 }
Ejemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     isAttacking  = false;
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <PlayerHealth>();
     anim         = GetComponent <Animator> ();
     monsterAudio = GetComponent <AudioSource> ();
     rigid        = GetComponent <Rigidbody> ();
     nav          = GetComponent <NavMeshAgent> ();
     stats        = GetComponent <MonsterStats> ();
 }
 /// <summary>
 /// Initialize les scripts pour le début du combat.
 /// </summary>
 void Initialize()
 {
     monsterStatsSCR = dungeon.GetComponent<MonsterStats>();
     heroStatsSCR = teamLeader.GetComponent<HeroStats>();
     heroStatsManagerSCR = teamLeader.GetComponent<HeroStatsManager>();
 }