// Update is called once per frame void FixedUpdate() { if (currentMove != null && !currentMove.Active()) { currentMove = null; currentState = State.Idle; } if (stunTime > 0) { if (currentMove != null) { currentMove = null; } stunTime--; if (stunTime <= 0) { currentState = State.Idle; } } //MAGIC NUMBERS FOR NOW: FIX //position of hitbox will be read from data later CollObject hurtBox1 = new CollObject(colliderID, this, new Vector2(this.transform.position.x, this.transform.position.y + 1.0f), 2, CollisionType.Hittable); CollObject hurtBox2 = new CollObject(colliderID, this, new Vector2(this.transform.position.x, this.transform.position.y + 3.0f), 2, CollisionType.Hittable); CollObject hurtBox3 = new CollObject(colliderID, this, new Vector2(this.transform.position.x, this.transform.position.y + 5.0f), 2, CollisionType.Hittable); CollObject hurtBox4 = new CollObject(colliderID, this, new Vector2(this.transform.position.x, this.transform.position.y + 7.0f), 2, CollisionType.Hittable); managerCollection.GetComponent <CollisionManagerScript>().AddCollBox(hurtBox1); managerCollection.GetComponent <CollisionManagerScript>().AddCollBox(hurtBox2); managerCollection.GetComponent <CollisionManagerScript>().AddCollBox(hurtBox3); managerCollection.GetComponent <CollisionManagerScript>().AddCollBox(hurtBox4); if (currentState == State.Attacking) { if (currentMove != null) { currentMove.Update(); } } DoMovement(); //Animations if (animations == null) { return; } if (currentState == State.Idle) { currentMove = this.inputReader.InputtedMove(); if (currentMove != null) { horSpeed = 0; currentState = State.Attacking; currentMove.Do(this); } } if (currentState == State.Idle) { if (Input.GetButton(buttonBlock)) { horSpeed = 0; animations.Play("block"); currentState = State.Blocking; } } else if (currentState == State.Blocking) { if (!Input.GetButton(buttonBlock)) { currentState = State.Idle; } } if (currentState == State.Idle) { if (horSpeed != 0) { animations.Play("walk"); } else { animations.Play("idle"); } } }