示例#1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        StickmanBody stickmanBody = collision.gameObject.GetComponent <StickmanBody>();

        if (stickmanBody == null)
        {
            return;
        }

        canvasManager.RestartMenu(true);
    }
示例#2
0
    //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();
    }
示例#3
0
    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();
            }
        }
    }
示例#4
0
    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);
    }
示例#5
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     _stickmanBody = collision.gameObject.GetComponent <StickmanBody>() ?? null;
 }