Example #1
0
 protected new void Update()
 {
     base.Update();
     try {
         if(sm.getState() == StateMachine.State.Free) {
             currentHealth = maxHealth;
             initSet = false;
             done = false;
             turn = false;
         }
     } catch (Exception e) {
         try {
             sm = GameObject.FindWithTag("MainCamera").GetComponent<StateMachine>();
         } catch (Exception ee) {}
     }
     if(dead()) {
         sm.dyingObject(gameObject);
         Destroy(gameObject);
     }
     try {
         setDirection(a.getDir());
     } catch (Exception e) {}
     setLocation(transform.position);
 }