Exemple #1
0
    protected override void CollisionReaction(Collider2D collision, GameObject collisionRoot, Rigidbody2D rigidbody)
    {
        Ball ballHit = collisionRoot.GetComponent <Ball>();

        if (ballHit != null)
        {
            rigidbody.AddForce((velocity * 25) * impactForce);
            ballHit.TakeDamage(damage);
            if (charged)
            {
                ballHit.ElectrifyBall();
            }
        }

        PlayerPhysicsMovement playerPhysics = collisionRoot.GetComponent <PlayerPhysicsMovement>();

        if (playerPhysics != null)
        {
            playerPhysics.AddVelocity((velocity * 10) * impactForce / 5);
        }

        StatsRPG stats = collisionRoot.GetComponent <StatsRPG>();

        if (stats != null)
        {
            Debug.Log("Damage dealth: " + finalDamage);
            stats.TakeDamage(finalDamage);
        }

        base.CollisionReaction(collision, collisionRoot, rigidbody);
    }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        standingScale  = new Vector4(-0.02f, 0.04f, 0.3f, 0.45f);
        crouchingScale = new Vector4(-0.02f, -0.01f, 0.3f, 0.35f);
        originalScale  = transform.localScale;
        flipScale      = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);

        playerPhysics    = GetComponent <PlayerPhysicsMovement>();
        sprRend          = GetComponentInChildren <SpriteRenderer>();
        abilities        = GetComponent <AbilityManager>();
        animationManager = GetComponentInChildren <AnimationManager>();
        attackContainer  = GetComponentInChildren <AttackContainer>();
    }