private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "White Platform")
     {
         this.demoState = DemolisherState.CoolDown;
     }
 }
 void DemolisherWait()
 {
     if (findPlayer)
     {
         this.demoState = DemolisherState.Destroy;
     }
 }
Exemple #3
0
        public void ChangeState(DemolisherState state, Fsm targetFsm)
        {
            currentFsm.OnExit();
            this.state = state;
            currentFsm = targetFsm;
            currentFsm.OnEnter();

            DebugUtils.LogWarning(DebugUtils.Type.AI_Demolisher, string.Format(" {0}'s demolisher {1} enter state {2} ", mark, id, this.state));
        }
 void DemolisherCoolDown()
 {
     if (Vector2.Distance(transform.position, originalPos) > accuracy)
     {
         this.transform.position += new Vector3(this.transform.position.x, upSpeed * Time.deltaTime, this.transform.position.z);
     }
     else if (Vector2.Distance(transform.position, originalPos) <= accuracy)
     {
         this.demoState = DemolisherState.Wait;
         findPlayer     = false;
     }
 }
Exemple #5
0
        public override void Reset()
        {
            id                  = -1;
            target              = null;
            state               = DemolisherState.NONE;
            speed               = FixVector3.zero;
            healthRecoverTimer  = 0;
            healthRegenInterval = 0;
            destroyTimer        = 0;
            destroyTime         = 0;
            owner               = false;
            town                = null;
            direction           = FixVector3.zero;
            bornPosition        = FixVector3.one;
            hp                  = 0;
            maxHp               = 0;
            damage              = 0;
            transform.position  = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            transform.rotation  = Quaternion.identity;

            PostRenderMessage    = null;
            PostDestroy          = null;
            FindOpponentBuilding = null;
        }
 // Start is called before the first frame update
 void Start()
 {
     this.demoState   = DemolisherState.Wait;
     findPlayer       = false;
     this.originalPos = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z);
 }