Ejemplo n.º 1
0
        public void DespawnPorjectile()
        {
            ProjectileBehavior projectile = rightHandSlot.GetComponentInChildren <ProjectileBehavior>();

            if (projectile != null)
            {
                Destroy(projectile.transform.parent.parent.gameObject);
            }
        }
Ejemplo n.º 2
0
        public void FireProjectile()
        {
            ProjectileBehavior projectile = rightHandSlot.GetComponentInChildren <ProjectileBehavior>();

            if (projectile != null)
            {
                projectile.Fire();
            }
        }
Ejemplo n.º 3
0
        private void OnTriggerEnter(Collider collision)
        {
            int   attackDamage;
            int   poiseDamage;
            float hitAngle;
            ProjectileBehavior projectile = null;

            CharacterManager character = collision.GetComponent <CharacterManager>();

            if (character == null)
            {
                return;
            }

            Attacker attacker = GetComponentInParent <Attacker>();
            Team     teamID;

            // If the attacker cannot be found, this is a projectile
            if (attacker == null)
            {
                projectile   = GetComponent <ProjectileBehavior>();
                attackDamage = projectile.damage;
                poiseDamage  = projectile.poiseDamage;
                teamID       = projectile.team;
                hitAngle     = Vector3.Angle(-projectile.transform.forward, character.transform.forward);
            }
            else
            {
                attackDamage = attacker.GetCurrentAttackDamage();
                poiseDamage  = attacker.GetCurrentAttackPoiseDamage();
                teamID       = GetComponentInParent <CharacterManager>().teamID;
                hitAngle     = Vector3.Angle(attacker.transform.forward, character.transform.forward);
            }
            if (character != null && character.teamID != teamID)
            {
                character.TakeDamage(attackDamage, poiseDamage, hitAngle);
            }

            if (projectile != null && (character == null || character.teamID != teamID))
            {
                Destroy(gameObject);
            }
        }