// Use this for initialization void Start() { sm = new FSMSystem(); Debug.Log("Add IdleState"); BossIdleState bis = new BossIdleState(); bis.AddTransition(Transition.NearPlayer, StateID.BossAttack); BossAttackState bas = new BossAttackState(); bas.AttackProjPrefab(proj); bas.AddTransition(Transition.LostPlayer, StateID.BossIdle); bas.shootInterval = shootInterval; sm.AddState(bis); sm.AddState(bas); //player = Global.Instance.player; Rigidbody2D rigidBody2D = GetComponent <Rigidbody2D>(); rigidBody2D.velocity = new Vector3(Random.value, Random.value, 0).normalized *flySpd; Global.Instance.boss = this.gameObject; hp = GetComponent <Health>(); hp.SetHp(_hp); EnemyHealthBar ehbscript = GetComponent <EnemyHealthBar>(); ehbscript.cam = Global.Instance.cam; }