private void OnTriggerEnter2D(Collider2D collision) { StickmanBody stickmanBody = collision.gameObject.GetComponent <StickmanBody>(); if (stickmanBody == null) { return; } canvasManager.RestartMenu(true); }
//Nina starts void OnJointBreak2D(Joint2D brokenJoint) { for (int i = 0; i < LowerPartsOfBody.Length; i++) { StickmanBody stickmanBody = LowerPartsOfBody[i].gameObject.GetComponent <StickmanBody>(); _levelManager.DestroyedPartsOfBodyList.Add(stickmanBody); stickmanBody.AreAddedToDestroyList = true; stickmanBody.DestroyedLowerPartsOfBody(); } _levelManager.DestroyStickmanBody(); }
public void DestroyedLowerPartsOfBody() { if (AreAddedToDestroyList) { for (int i = 0; i < LowerPartsOfBody.Length; i++) { _levelManager.DestroyedPartsOfBodyList.Add(LowerPartsOfBody[i].GetComponent <StickmanBody>()); StickmanBody stickmanBody = LowerPartsOfBody[i].gameObject.GetComponent <StickmanBody>(); stickmanBody.AreAddedToDestroyList = true; stickmanBody.DestroyedLowerPartsOfBody(); } } }
void FixedUpdate() { float CurrectVelocity = ModuleVector(Body.velocity); float CurrentDeltaVelocity = Mathf.Abs(CurrectVelocity - LastVelocity); float DeltaPick = Mathf.Abs(CurrentDeltaVelocity - LastDeltaVelocity); if (DeltaPick > 4) { if (_stickmanBody != null) { _stickmanBody.Damage(DeltaPick); _stickmanBody = null; } } LastDeltaVelocity = CurrentDeltaVelocity; LastVelocity = ModuleVector(Body.velocity); }
private void OnCollisionEnter2D(Collision2D collision) { _stickmanBody = collision.gameObject.GetComponent <StickmanBody>() ?? null; }