private void SelectCharacter()
 {
     GameObject.FindGameObjectWithTag("Global").GetComponent <MenuToGame>().playerCharacter[playerIndexInt - 1] = selectedCharacter;
     scale_temp  = new Vector2((1 / numberOfCharacters) - .05f, .6f);
     offset_temp = new Vector2(offset.x + .025f, offset.y + .3f);
     colorFlash.FlashToColor(new Color(2000, 2000, 2000, 1000), 0.0f, .1f);
     selectButton.SetActive(true);
     characterSelected = true;
     selectButton.transform.position = new Vector3(transform.position.x + UnityEngine.Random.Range(-.35f, .35f), transform.position.y - .3f + UnityEngine.Random.Range(-.35f, .35f), selectButton.transform.position.z);
     Invoke("ResetPosScale", .1f);
 }
Beispiel #2
0
    private void KnockBack(Vector3 source, float multiplier)
    {
        Vector2 hitDirection = gameObject.transform.position - source;

        hitDirection.Normalize();

        dontMove = true;
        Invoke("FixedMovement", .1f);
        gameObject.rigidbody2D.AddForce(hitDirection * maxKnockback.x * multiplier);

        if (enableScreenShake)
        {
            iTween.PunchPosition(mainCamera, -(hitDirection * maxKnockback.y * multiplier), .35f);
        }

        colorFlash.FlashToColor(new Color(1, 1, 1, 500), .1f, .1f);
    }