Example #1
0
    protected virtual void Start()
    {
        HP = HPMax;
        dropInfo = GameController._instance.GetEnemyInfo(this.enemyID);
        hash = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<HashIDs>();
        anim = this.GetComponent<Animator>();
        enemyManager = EnemyManager._instance;

        normalActionList = actionList.GetNormalActionEvents();
        attackActionList = actionList.GetAttackActionEvents();
        dieActionList = actionList.GetDieActionEvents();
        hitActionList = actionList.GetHitActionEvents();


        playerPosition = PlayerState._instance.playerTransform.position;


        Init();
    }
Example #2
0
    void LoadenemyInfo()
    {
        if (enemyInfoDictionary == null)
        {
            string[] proArray;
            string[] dataArray = enemyInfoData.ToString().Split('\n');
            string[] dropItemIDArray;
            string[] dropItemLVArray;
            string[] dropItemPreArray;
            List<dropItem> dropItemList;
            enemyInfoDictionary = new Dictionary<int, EnemyDropInfo>();
            for (int i = 1; i < dataArray.Length; i++)
            {
                if (dataArray[i] != "")
                {
                    proArray = dataArray[i].Split(',');
                    dropItemIDArray = proArray[2].Split('|');
                    dropItemLVArray = proArray[3].Split('|');
                    dropItemPreArray = proArray[4].Split('|');

                    if (dropItemIDArray.Length != dropItemLVArray.Length || dropItemLVArray.Length != dropItemPreArray.Length)
                    {
                        Debug.LogError("DropInfomationError!");
                        return;
                    }
                    else
                    {
                        dropItemList = new List<dropItem>();
                        for (int j = 0; j < dropItemIDArray.Length; j++)
                        {
                            dropItemList.Add(new dropItem()
                            {
                                itemID = int.Parse(dropItemIDArray[j]),
                                dropItemLV = int.Parse(dropItemLVArray[j]),
                                dropItemPre = int.Parse(dropItemPreArray[j])

                            });
                        }
                    }
                    enemyInfo = new EnemyDropInfo(int.Parse(proArray[0]), proArray[1], dropItemList, float.Parse(proArray[5]));
                    enemyInfoDictionary.Add(enemyInfo.ID, enemyInfo);
                }
            }
        }
    }