예제 #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);
    }
예제 #2
0
    private void Start()
    {
        playerStats   = player.GetComponent <StatsRPG>();
        playerManager = player.GetComponent <InputToIntent>();
        playerProfile = player.GetComponent <PlayerProfile>();
        //Debug.Log($"player colour {playerProfile.colour}");
        transform.GetComponent <Image>().material = player.GetComponentInChildren <SpriteRenderer>().material;

        //Debug.Log($"player Hud {transform.parent.GetComponent<Image>().color}");

        nameText         = transform.Find("Name Text").gameObject;
        hpText           = transform.Find("HP Text").gameObject;
        mpText           = transform.Find("MP Text").gameObject;
        shardText        = transform.Find("Shard Text").gameObject;
        abilityContainer = transform.Find("Abilities").gameObject;
        List <BaseAbility> abilities = player.GetComponent <AbilityManager>().abilities;

        for (int i = 0; i < abilities.Count; i++)
        {
            GameObject abilityIcon = Resources.Load <GameObject>("UI/Ability Icon");
            abilityIcon = Instantiate(abilityIcon, abilityContainer.transform);
            abilities[i].CanActivate = true;
            abilityIcon.GetComponent <AbilityIcon>().Ability = abilities[i];
        }
    }
예제 #3
0
    private void Start()
    {
        player = transform.root.gameObject;

        intentToAction               = player.GetComponent <IntentToAction>();
        initialAttackDisplacement    = player.GetComponent <Collider2D>().bounds.size;
        initialAttackDisplacement.y /= 2;

        statsRPG = player.GetComponent <StatsRPG>();

        LoadWeapon();
        SwitchWeapon();

        animator = activeWeapon.transform.GetChild(0).GetComponent <Animator>();
    }