private void OnTriggerEnter(Collider other)
    {
        ElementalProjectile elemProj = other.GetComponent <ElementalProjectile>();

        if (elemProj == null)
        {
            other.transform.parent = _parent;
        }
    }
    public void SpellFire(Vector3 dirSpell)
    {
        ElementalProjectile elementalProjectile = Instantiate(_firePrefab, transform.position, Quaternion.identity, _projectileContainer);

        if (dirSpell != Vector3.zero)
        {
            elementalProjectile.Init(dirSpell, gameObject.GetInstanceID());
        }
        else
        {
            elementalProjectile.Init(transform.right, gameObject.GetInstanceID());
        }
    }
示例#3
0
    private void SpellWater(Vector3 dirSpell)
    {
        ElementalProjectile projectile = Instantiate(_waterPrefab, transform.position, Quaternion.identity, _projectileContainer);

        if (dirSpell != Vector3.zero)
        {
            projectile.Init(dirSpell, gameObject.GetInstanceID());
        }
        else
        {
            projectile.Init(transform.right, gameObject.GetInstanceID());
        }
    }
    //A RECODER EN STATE MACHINE


    public void SpellWater(Vector3 dirSpell)
    {
        ElementalProjectile projectile = Instantiate(_waterPrefab, transform.position, Quaternion.identity, _projectileContainer);

        AudioManager.Instance.PlayRandomSFX("WATERSHOOT");

        if (dirSpell != Vector3.zero)
        {
            projectile.Init(dirSpell, gameObject.GetInstanceID());
        }
        else
        {
            projectile.Init(transform.right, gameObject.GetInstanceID());
        }
    }
示例#5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Collectible")
        {
            //Collectibles collectibles = other.gameObject.GetComponent<Collectibles>();

            /*  if(collectibles != null)
             * {
             *   // _characHealth.GetLifeBack(collectibles.LifeHealed);
             *    Destroy(other.gameObject);
             * }*/
        }
        ElementalProjectile elemProj = other.GetComponent <ElementalProjectile>();

        if (elemProj != null && elemProj.InstanceID != gameObject.GetInstanceID())
        {
            Destroy(other.gameObject);
        }

        if (other.gameObject.layer == 17)
        {
            //     DamageFireSurface dmgFire = other.GetComponent<DamageFireSurface>();

            /*
             * if (dmgFire != null && _invulnerable == false && _elemCharac.IsImune == false)
             * {
             * // _characHealth.TakeDamage(dmgFire.Damages);
             *  _invulnerable = true;
             * }*/
        }

        if (other.gameObject.layer == 18)
        {
            ElementalProjectile elemProject = other.GetComponent <ElementalProjectile>();

            if (elemProject != null && _invulnerable == false && _elemCharac.IsImune == false)
            {
                //  _characHealth.TakeDamage(elemProject.Damages);
                _invulnerable = true;
            }
        }
    }
示例#6
0
    private void OnTriggerEnter(Collider collider)
    {
        // Check if other is AElement
        AElement other = collider.GetComponent <AElement>();

        if (other != null)
        {
            if (other is ElementalProjectile)
            {
                ElementalProjectile elemProj = other.GetComponent <ElementalProjectile>();
                if (elemProj.InstanceID != gameObject.GetInstanceID())
                {
                    // React with other's element
                    ElementalReaction(other.Element);
                }
            }
            else
            {
                // React with other's element
                ElementalReaction(other.Element);
            }
        }
    }