protected virtual void Start() { bossPhysics = transform.parent; animator = GetComponent <Animator>(); bossStatus = GetComponent <BossStatus>(); spriteRenderer = GetComponent <SpriteRenderer>(); bossMovement = bossPhysics.GetComponent <BossMovement>(); controller = bossPhysics.GetComponent <Controller2D>(); currentState = State.Idle; transitionState = State.Idle; //temporaryState = State.None; SetAnimTimeDictionary(); CachingAnimation(); }
void Start() { gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); controller = GetComponent <Controller2D>(); direction = new Vector2(0, 0); playerPos = GameObject.FindGameObjectWithTag("Player"); boxCollider = GetComponent <BoxCollider2D>(); bossStatus = transform.GetChild(0).GetComponent <BossStatus>(); SetCrushedArea(); coroutineCycle = 0.1f; waitTime = new WaitForSeconds(coroutineCycle); //StartCoroutine(CheckCrushed()); }