public IEnumerator ClimbBlock(PushableBase pushableObject, Action action) { if (pushableObject.GetPushBlock().TopBlocked()) { action(); yield break; } iTween.MoveTo(gameObject, pushableObject.GetPushBlock().transform.position.SetY(pushableObject.GetPushBlock().transform.position.y + 2.5f), .4f); action(); yield break; }
//TODO: Put in the timing things like walking to the block I dunno public IEnumerator EngageBlock(PushableBase block, Action doneAction) { _pushPoint = block; SoundManager.Instance.Stop(SoundManager.SoundEffect.Walk); //Get push direction for block (+/-X or +/-Z) //pushDirection = block.transform.forward; //Orient player toward block GetComponent<UserMovement>().RotateTo(block.GetOrientation()); //Move player next to block transform.position = block.GetPosition().SetY(transform.position.y); pushDirection = GetComponent<UserMovement>().playerMesh.forward; //child block to player if (!block.GetPushBlock().IsSlippery) { transform.parent = block.transform.parent; } //Set input type to block pushing _blockEngaged = true; doneAction(); yield return null; }