Пример #1
0
    public override void Init(Creature creature, ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        base.Init(creature, weaponData, weaponDesc);

        m_destroy = false;
        m_elapsed = Time.time;
        creature.EnableNavMeshObstacleAvoidance(false);
    }
Пример #2
0
    public void Init(Creature owner, RefMob refMob, RefItem refItem, int level, int evolution)
    {
        base.Init(refMob, level, evolution);

        m_owner = owner;
        m_owner.AddFollower(this);

        CreatureType = m_owner.CreatureType;
        m_consumedSP = refItem.consumedSP;

        if (m_creatureProperty.MoveSpeed == 0f)
        {
            EnableNavMeshObstacleAvoidance(false);
        }

        Transformation(transform, evolution);

        switch(refMob.mobAI)
        {
        case MobAIType.Normal:
            m_ai = new MobAINormal();
            break;
        case MobAIType.Rotation:
            m_ai = new MobAIRotation();
            break;
        case MobAIType.FlyingAround:
            m_ai = new MobAIFlyingAround();
            break;
        case MobAIType.ItemShuttle:
            m_ai = new MobAIItemShuttle();
            break;
        case MobAIType.Pickup:
            m_ai = new MobAIPickup();
            ((MobAIPickup)(m_ai)).SetOwner(m_owner);
            CreatureType = Type.Npc;
            gameObject.layer = 0;
            break;
        case MobAIType.Follow:
            m_ai = new MobAIFollow();
            ((MobAIFollow)(m_ai)).SetOwner(m_owner);
            CreatureType = Type.ChampNpc;
            gameObject.layer = 0;
            StartCoroutine(DecSpEffect());
            break;
        }

        m_ai.Init(this);
    }
Пример #3
0
    void buildSpawnMob(SpawnMobDescResult result, RefMobSpawnRatio.Desc spawnRatioDesc, RefMob[] mobs, bool monitoredDeath, bool boss)
    {
        if (spawnRatioDesc == null)
            return;

        if (spawnRatioDesc.chance < Random.Range(0f, 1f))
            return;

        float progress = ProgressStage();

        int minIndex = 0;
        int maxIndex = Mathf.Min((int)progress, mobs.Length-1);
        //Debug.Log("min:" + minIndex + ", max:" + maxIndex + ", progress:" + progress);
        minIndex = Mathf.Clamp(minIndex, 0, mobs.Length-1);

        int mobCount = (int)(spawnRatioDesc.count[0]);
        int mobLength = spawnRatioDesc.count[1]-spawnRatioDesc.count[0];
        int stage = GetStage()-1;
        if (boss == true)
        {
            if (stage < RefData.Instance.RefBossMobs.Length)
            {
                result.spawnMobs.Add(mobs[maxIndex]);
            }
            else
            {
                result.spawnMobs.Add(mobs[Random.Range(minIndex, maxIndex+1)]);

                mobCount += Mathf.Min(mobLength, stage/(m_refWorldMap.waves.Length*RefData.Instance.RefBossMobs.Length));
            }
        }
        else
        {
            result.spawnMobs.Add(mobs[Random.Range(minIndex, maxIndex+1)]);
            mobCount += Mathf.Min(mobLength, stage/(m_refWorldMap.waves.Length*RefData.Instance.RefBossMobs.Length));

        }

        result.spawnMobCount.Add(mobCount);
        result.spawnMobMonitored.Add(monitoredDeath);
        result.spawnMobBoss.Add(boss);
        result.spawnEffectType.Add(spawnRatioDesc.spawnEffectType);
    }
Пример #4
0
    public Mob SpawnMob(RefMob refMob, int mobLevel, Vector3 pos, bool boss, bool monitoredDeath)
    {
        RefItemSpawn[] refDropItems = null;
        if (GetCurrentWave().itemSpawn.mapMobItems.ContainsKey(refMob.id))
        {
            refDropItems = GetCurrentWave().itemSpawn.mapMobItems[refMob.id].refDropItems;
        }
        else
        {
            refDropItems = GetCurrentWave().itemSpawn.defaultItem;
        }

        GameObject prefEnemyBody = Resources.Load<GameObject>("Pref/mon_skin/" + refMob.prefBody);
        if (prefEnemyBody == null)
        {
            Debug.Log(refMob.prefBody);
            return null;
        }
        Vector3 enemyPos = pos;

        enemyPos.x = Mathf.Clamp(enemyPos.x, m_edgeRect.transform.position.x-m_edgeRect.size.x/2, m_edgeRect.transform.position.x+m_edgeRect.size.x/2);
        enemyPos.z = Mathf.Clamp(enemyPos.z, m_edgeRect.transform.position.z-m_edgeRect.size.z/2, m_edgeRect.transform.position.z+m_edgeRect.size.z/2);

        GameObject enemyObj = Creature.InstanceCreature("Pref/mon/"+refMob.prefHead, prefEnemyBody, enemyPos, Quaternion.Euler (0, 0, 0)) as GameObject;

        enemyObj.transform.localScale = new Vector3(refMob.scale, refMob.scale, refMob.scale);

        Mob enemy = enemyObj.GetComponent<Mob>();
        enemy.Init(refMob, mobLevel, refDropItems, boss);
        enemy.m_creatureProperty.HP = enemy.m_creatureProperty.MaxHP;
        enemy.m_creatureProperty.SP = enemy.m_creatureProperty.MaxSP;

        for(int i = 1; i < mobLevel; ++i)
            enemy.WeaponHolder.LevelUp(0);

        enemy.SetTarget(m_champ);

        Debug.Log(refMob.prefBody + ", Lv : " + mobLevel + ", HP: " + enemy.m_creatureProperty.HP + ", PA:" + enemy.m_creatureProperty.PhysicalAttackDamage + ", PD:" + enemy.m_creatureProperty.PhysicalDefencePoint + ", scale:" + refMob.scale + " pos:" + enemyPos);

        if (monitoredDeath == true)
        {
            enemy.CheckOnDeath = true;
            m_mobsOfCheckOnDeath++;
        }

        return enemy;
    }
Пример #5
0
    public void SetSubWeapon(Weapon weapon, ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        Weapon subWeapon = instanceWeapon(weaponData, weaponDesc);

        weapon.SetSubWeapon(subWeapon);
    }
Пример #6
0
    public Weapon instanceWeapon(ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        GameObject obj = Instantiate (weaponData.PrefWeapon, Vector3.zero, Quaternion.Euler(0, 0, 0)) as GameObject;
        Weapon weapon = obj.GetComponent<Weapon>();

        obj.transform.parent = m_weaponHolder.transform;
        obj.transform.localPosition = weaponData.PrefWeapon.transform.localPosition;
        obj.transform.localRotation = weaponData.PrefWeapon.transform.localRotation;
        obj.transform.localScale = weaponData.PrefWeapon.transform.localScale;

        weapon.Init(this, weaponData, weaponDesc);

        return weapon;
    }
Пример #7
0
    public virtual void Init(RefMob refMob, int level, int evolution)
    {
        m_navAgent = GetComponent<NavMeshAgent>();
        m_targeting = null;
        m_ingTakenDamageEffect = 0;
        m_pushbackSpeedOnDamage = 0;
        m_behaviourType = BehaviourType.ALive;

        m_weaponHolder = transform.Find("WeaponHolder").gameObject.GetComponent<WeaponHolder>();
        m_weaponHolder.Init();

        if (transform.Find("Body/WeaponPoint") != null)
        {
            m_weaponHolder.transform.position = transform.Find("Body/WeaponPoint").transform.position;
        }

        damagedTexture = Resources.Load<Texture>("ani/damage monster");
        normalTexture = Resources.Load<Texture>("ani/monster");
        ChangeNormalColor();

        m_refMob = refMob;
        m_creatureProperty.init(this, m_refMob.baseCreatureProperty, level, evolution);
        rigidbody.mass = refMob.mass;
        m_navAgent.baseOffset = m_refMob.baseCreatureProperty.navMeshBaseOffset;

        m_aimpoint = transform.Find("Body/Aimpoint").gameObject;
        m_hppoint = m_aimpoint;

        if (transform.Find("Body/HPPoint"))
        {
            m_hppoint = transform.Find("Body/HPPoint").gameObject;
        }
        m_animator = transform.Find("Body").GetComponent<Animator>();

        m_prefDamageSprite = Resources.Load<GameObject>("Pref/DamageNumberSprite");
    }
Пример #8
0
    public virtual Weapon EquipWeapon(ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        Weapon weapon = instanceWeapon(weaponData, weaponDesc);

        weapon.m_callbackCreateBullet = delegate() {
            if (m_animator != null)
            {
                m_animator.SetTrigger("Attack");
            }
        };

        m_weaponHolder.EquipWeapon(weapon);

        if (weapon.WeaponStat.skillId > 0)
        {
            EquipActiveSkillWeapon(new ItemWeaponData(weapon.WeaponStat.skillId), new RefMob.WeaponDesc());
        }

        return weapon;
    }
Пример #9
0
    public void EquipPassiveSkillWeapon(ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        Weapon weapon = instanceWeapon(weaponData, weaponDesc);

        m_weaponHolder.EquipPassiveSkillWeapon(weapon);
    }
Пример #10
0
    public virtual Weapon EquipActiveSkillWeapon(ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        Weapon weapon = instanceWeapon(weaponData, weaponDesc);

        m_weaponHolder.EquipActiveSkillWeapon(weapon);

        return weapon;
    }
Пример #11
0
    public virtual void Init(Creature creature, ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        m_creature = creature;
        m_gunPoint = creature.WeaponHolder.gameObject;
        m_refWeaponItem = weaponData.RefItem;

        m_lastCreated = Time.time;
        m_firing = false;
        m_level = 0;
        m_maxLevel = weaponDesc.maxLevel;

        m_weaponStat = new WeaponStat();
        if (weaponDesc.weaponStat == null)
        {
            m_weaponStat.OverrideStat(m_refWeaponItem.weaponStat);
        }
        else
        {
            m_weaponStat.OverrideStat(weaponDesc.weaponStat);
            m_weaponStat.OverrideStat(m_refWeaponItem.weaponStat);

        }

        for(int i = 0; i <= m_weaponStat.firingCount; ++i)
            MoreFire();

        m_evolution = weaponData.Evolution;

        if (m_evolution > 0)
        {
            for(int i = 1; i <= m_maxLevel; ++i)
            {
                if (canCreateMoreFire(i))
                    MoreFire();
            }
        }

        for(int i = 0; i < weaponData.Level; ++i)
            LevelUp();
    }
Пример #12
0
    public override void Init(RefMob refMob, int level, int evolution)
    {
        base.Init(refMob, level, evolution);

        m_lastLevelupTime = Time.time;
    }
Пример #13
0
 /*
 void OnGUI()
 {
     UpdateChampMovement();
 }
 */
 public override Weapon EquipWeapon(ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
 {
     Weapon weapon = base.EquipWeapon(weaponData, weaponDesc);
     if (weaponData.RefItem.partName != null)
         transform.Find("Body/"+weaponData.RefItem.partName).gameObject.SetActive(true);
     return weapon;
 }
Пример #14
0
    public override Weapon EquipActiveSkillWeapon(ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        Weapon weapon = base.EquipActiveSkillWeapon(weaponData, weaponDesc);

        if (weapon.RefWeaponItem.id == Const.ChampTapRefItemId)
        {
            m_tapWeapon = weapon;
        }

        return weapon;
    }
Пример #15
0
    public void Init(RefMob refMob, int mobLevel, RefItemSpawn[] refDropItems, bool boss)
    {
        base.Init(refMob, mobLevel, 0);

        RefMob = refMob;
        RefDropItems = refDropItems;
        Boss = boss;

        if (Random.Range(0f, 1f) < 0.3f)
            m_creatureProperty.BetaMoveSpeed = 1.7f;
        /*
        if (true == Boss)
        {
            transform.Find("FloatingHealthBarGUI").gameObject.SetActive(true);
        }*/

        GameObject prefDeathEffect = Resources.Load<GameObject>("Pref/mon_skin/"+refMob.prefBody+"_death");
        if (prefDeathEffect != null)
        {
            m_prefDeathEffect = prefDeathEffect;
        }

        foreach(RefMob.WeaponDesc weaponDesc in refMob.refWeaponItems)
        {
            if (weaponDesc.reqLevel > mobLevel)
                continue;

            if (weaponDesc.passive == true)
            {
                EquipPassiveSkillWeapon(new ItemWeaponData(weaponDesc.refItemId), weaponDesc);
            }
            else
            {
                EquipWeapon(new ItemWeaponData(weaponDesc.refItemId), weaponDesc);
            }

        }

        switch(refMob.mobAI)
        {
        case MobAIType.Normal:
            m_ai = new MobAINormal();
            break;
        case MobAIType.Rotation:
            m_ai = new MobAIRotation();
            break;
        case MobAIType.FlyingAround:
            m_ai = new MobAIFlyingAround();
            CreatureType = Type.MobNpc;
            break;
        case MobAIType.ItemShuttle:
            m_ai = new MobAIItemShuttle();
            break;
        case MobAIType.Dummy:
            m_ai = new MobAIDummy();
            break;
        case MobAIType.Bomber:
            m_ai = new MobAIBomber();
            break;
        case MobAIType.Egg:
            m_ai = new MobAIEgg();
            break;
        }

        m_ai.Init(this);
    }
Пример #16
0
    public override void Init(Creature creature, ItemWeaponData weaponData, RefMob.WeaponDesc weaponDesc)
    {
        base.Init(creature, weaponData, weaponDesc);

        m_aliveBullets = 0;
    }