コード例 #1
0
    protected override void InitializeAbility()
    {
        cooldown = enemy.baseEnemy.GetSpecialAbilityFloat("cooldown");;
        //Default values that won't clobber inspector values
        if (cooldown <= 0)
        {
            cooldown = 6;
        }
        enemyType = enemy.baseEnemy.GetSpecialAbilityInt("type");
        MonsterData.Level monster = GameData.instance.GetMonster(enemyType);
        if (monster != null)
        {
            enemyPrefab = monster.GetPrefab();

            if (enemyPrefab == null)
            {
                monster = GameData.instance.GetMonster(0);

                if (monster != null)
                {
                    enemyPrefab = monster.GetPrefab();
                }

                if (enemyPrefab == null)
                {
                    Destroy(this);
                    Debug.LogWarning("Summoned enemy not found! Removing Summon ability");
                }
            }
        }
        myScript = GetComponent <Enemy> ();
    }
コード例 #2
0
ファイル: LevelData.cs プロジェクト: oushiff/TowerDefenseAI
        public void AddMonster(int _amount, float _seconds, MonsterData.Level _monster)
        {
            Monster newMonster = new Monster();

            newMonster.amount  = _amount;
            newMonster.seconds = _seconds;
            newMonster.monster = _monster;
            monsters.Add(newMonster);
        }
コード例 #3
0
    public void SetStats(int level)
    {
        MonsterData.Level monster = GameData.instance.GetMonster(level);

        if (monster != null)
        {
            damage = monster.damage;
            range  = monster.range;
        }
    }
コード例 #4
0
ファイル: Enemy.cs プロジェクト: oushiff/TowerDefenseAI
 public void Load(MonsterData.Level baseProperties)
 {
     damage             = baseProperties.damage;
     hp                 = maxHp = baseProperties.hp;
     armor              = baseProperties.armor;
     range              = baseProperties.range;
     rateOfFire         = baseProperties.rateOfFire;
     coins              = baseProperties.gain;
     this.originalSpeed = speed = baseProperties.speed;
     mana               = baseProperties.mana;
     flying             = baseProperties.monster.air;
 }
コード例 #5
0
ファイル: Enemy.cs プロジェクト: oushiff/TowerDefenseAI
    void Start()
    {
        this.baseEnemy = GameData.instance.GetMonster(level);

        //load enemy paramaters from the excelsheet
        EnemyProperties baseProperties = new EnemyProperties();

        baseProperties.Load(this.baseEnemy);
        properties = new EnemyPropertiesQueue();
        properties.Initialize(baseProperties, Time.time);

        InvokeRepeating("Attack", (float)properties.active.rateOfFire, (float)properties.active.rateOfFire);
        //dynamic health bar

        wayPoints = Grid.instance.wayPoints;
        //position the object at the start of the path
        if (nextPointIndex > 0 && nextPointIndex < wayPoints.Length && wayPoints.Length > 0 && wayPoints[nextPointIndex - 1] != null)
        {
            this.transform.position = wayPoints[nextPointIndex - 1].position;
        }

        healthBar = UIManager.instance.GetHealthBar();
        healthBar.UpdateName(this.baseEnemy.name);
    }