Example #1
0
    private void InitEnemy()
    {
        _enemyStateManager = new EnemyStateManager();

        //enemy load
        if (null != Enemy[0])
        {
            _enemyStateList = new List <EnumyState>();
            _wayPoint       = new List <Vector3>();

            _wayPoint.Add(new Vector3(-127.0f, 1.6f, -132.0f));
            _wayPoint.Add(new Vector3(-127.0f, 1.6f, -227.0f));
            _wayPoint.Add(new Vector3(-127.0f, 1.6f, -418.0f));
            _wayPoint.Add(new Vector3(-288.0f, 1.6f, -420.0f));
            _wayPoint.Add(new Vector3(-452.0f, 1.6f, -418.0f));
            _wayPoint.Add(new Vector3(-452.0f, 1.6f, -277.0f));
            _wayPoint.Add(new Vector3(-452.0f, 1.6f, -132.0f));
            _wayPoint.Add(new Vector3(-614.0f, 1.6f, -132.0f));

            for (int i = 0; i < _wayPoint.Count; ++i)
            {
                int        EnemyTypeNum = Random.Range(0, Enemy.Length);
                GameObject EnemyObject  = Instantiate(Enemy[EnemyTypeNum]) as GameObject;
                EnemyObject.transform.position = _wayPoint[i];
                EnemyObject.gameObject.name    = "Enemy_" + i;
                ObjectUI objUI      = EnemyObject.AddComponent <ObjectUI>();
                var      enumyState = EnemyObject.GetComponent <EnumyState>();
                enumyState.SetHpBar(objUI);
                _enemyStateList.Add(enumyState);
            }
        }
    }
Example #2
0
 private void InitPlayer()
 {
     //player load
     if (null != Player)
     {
         GameObject PlayerObject = GameObject.Instantiate(Player) as GameObject;
         PlayerObject.transform.position = new Vector3(0, 1.75f, -20.0f);
         ObjectUI objUI = PlayerObject.AddComponent <ObjectUI>();
         objUI.Init(100);
         _player = PlayerObject.GetComponent <Player>();
         _player.SetHpBar(objUI);
     }
 }
Example #3
0
 void ToggleClothingUI(bool open)
 {
     ClothingUI.SetActive(open);
     ObjectUI.SetActive(!open);
 }
Example #4
0
 public void SetHpBar(ObjectUI objectUI)
 {
     _objectUI = objectUI;
     _objectUI.Init(_hp);
 }
Example #5
0
 public void SetHpBar(ObjectUI objectUI)
 {
     _objectUI = objectUI;
 }