public override void Start() { base.Start(); grappleStartPos = grapple.transform.localPosition; chain = gameObject.GetComponent<LineRenderer>(); playerMove = player.GetComponent<PlayerMove>(); state = OgreState.Hunting; currentTimer = grappleReloadTimer; Debug.Log(health); }
void CheckState() { if (state != OgreState.Pulling && distToPlayer <= grappleMaxRange && distToPlayer >= grappleMinRange && currentTimer >= grappleReloadTimer) { state = OgreState.Throwing; timer2 = 0f; return; } if (state == OgreState.Throwing && (timer2 >= grapplePullTimer || hook.playerHooked || hook.collidedWithArena)) { state = OgreState.Pulling; timer2 = 0f; return; } }
void ResumeHunting() { hook.canGrapple = true; state = OgreState.Hunting; currentTimer = 0f; }
void PullGrappleBack() { if (hook.playerHooked) { player.position = hook.transform.position; } grapple.transform.localPosition = Vector2.Lerp(grapple.transform.localPosition, grappleStartPos, Time.deltaTime); if (timer2 > grapplePullTimer || Vector2.Distance(grapple.transform.localPosition, grappleStartPos) < .2f) { grapple.transform.localPosition = grappleStartPos; hook.collidedWithArena = false; timer2 = 0f; currentTimer = 0f; state = OgreState.Hunting; } }