Exemplo n.º 1
0
 public virtual void MoveTowardsTarget(EntityLivingBase _target)
 {
     SetPosition(new Vector3(
                     GetPosition().x + (((GetPosition().x - _target.GetPosition().x) < 0 ? -F_speed : F_speed) * Time.deltaTime),
                     GetPosition().y,
                     GetPosition().z + (((GetPosition().z - _target.GetPosition().z) < 0 ? -F_speed : F_speed)) * Time.deltaTime));
 }
Exemplo n.º 2
0
    /** OnCollisionEnter private void.
     * When the Trident is colliding something if it is an entity (not a player),
     * it notifies the ApplyEffectOnHit method from the TridentLaunchSpell of its launcher.
     **/
    public override void ApplyEffect(Collider collision)
    {
        EntityLivingBase entityHit = collision.gameObject.GetComponent <EntityLivingBase>();

        if (entityHit != null && entityHit.gameObject.tag != "Player")
        {
            launcher.GetComponent <TridentLaunchSpell>().ApplyEffectOnHit(entityHit);
        }
    }
Exemplo n.º 3
0
    /** LaunchSpell : public override void Method
     * The LauncheSpell Method is called by the abstract Class Classe when the player press the key associated to the spell.
     * First at all, we launch the mother method to initialize the spell launching.
     * If the spell is Launcheable, we create a new List that will contains the targets freshly affected by new IgniteStatus.
     * Then, we explode every targets already affected by an IgniteStatus (making damage to this target).
     * In order to get the new targets that are getting new igniteStatus, we use an overlapSphere.
     * For every collider touched by the overlap sphere we only want to get Colliders of Monsters that have not explosed and are not explosable.
     * Once we get the correct targets, We first apply an explosion damage.
     * Then, we launch a random to instantiate or not ignite on the correct target.
     * Please note that the random can be ignored if CritSuccess was set to true by the FireBlessingSpell.
     * If the random is a success, we instantiate a fresh Ignite child of the target (by adding a new one or reseting the current one).
     * After that, we add the new Frsh targets with fresh ignites to the targetsToAdd List. Then, we refresh the targetsExploded list, by adding the target that just exploded
     * These steps ensures that targets can not explode 2 times and get a new fresh igniteStatus after an explosion.
     * Then, we clear the old ignites on explosed targets and we add the new fresh targets to the target List. We also ensure that CritSuccess is reset to false and we clear the FireBlessingSpell Status.
     * Finally we call the OnSpellLaunched mother method to tell the spell is not in use anymore.
     **/
    public override void LaunchSpell()
    {
        base.LaunchSpell();

        if (!IsSpellLauncheable())
        {
            return;
        }

        List <IgniteStatus> targetsToAdd = new List <IgniteStatus>();

        foreach (IgniteStatus target in Targets)
        {
            EntityLivingBase entity = target.GetComponentInParent <EntityLivingBase>();
            entity.DamageFor(Damages[0]);
            Collider[] cols = Physics.OverlapSphere(entity.transform.position, 10f);
            TargetsExploded.Add(target.GetComponent <Collider>());
            target.ExplodeIgniteStatus();

            foreach (Collider col in cols)
            {
                if (col.gameObject.GetComponent <EntityLivingBase>() &&
                    !col.isTrigger &&
                    !TargetsExploded.Contains(col) &&
                    !Targets.Contains(col.GetComponent <IgniteStatus>()))
                {
                    col.gameObject.GetComponent <EntityLivingBase>().DamageFor(Damages[0]);
                    if (Random.Range(0, 100) < int.Parse(OtherValues[0]) || CritSuccess)
                    {
                        IgniteStatus ignite = col.gameObject.GetComponentInChildren <IgniteStatus>();
                        if (ignite != null)
                        {
                            ignite.ResetStatus();
                        }
                        else
                        {
                            GameObject newIgnite = ApplyStatus(GetComponent <FireBallSpell>().Status[0], col.transform);
                            ignite = newIgnite.GetComponentInChildren <IgniteStatus>();
                        }
                        targetsToAdd.Add(ignite);
                    }
                }
            }
        }
        TargetsExploded.Clear();
        Targets.Clear();
        Targets = targetsToAdd;

        if (CritSuccess)
        {
            GetComponentInChildren <FavorOfFireStatus>().DestroyStatus();
        }

        CritSuccess = false;
        base.OnSpellLaunched();
    }
Exemplo n.º 4
0
 public AIChaseTarget(int _priority, EntityLivingBase _entity, System.Type _type, float _range)
 {
     f_range            = _range;
     i_priority         = _priority;
     ent_main           = _entity;
     type_target        = _type;
     s_ID               = "Movement";
     s_display_name     = "Chase Target - " + type_target;
     b_is_interruptable = true;
 }
Exemplo n.º 5
0
 public AIDodge(int _priority, EntityLivingBase _entity, System.Type _type, float _range, int _chance)
 {
     i_chance           = _chance;
     f_range            = _range;
     i_priority         = _priority;
     ent_main           = _entity;
     type_target        = _type;
     s_ID               = "Combat";
     s_display_name     = "Dodge From Target - " + type_target;
     b_is_interruptable = true;
 }
Exemplo n.º 6
0
    /// <summary>
    /// override OnTriggerEnter method of MeleAttack Class
    /// This method Checks if there is a collision between the weapon and the enemy
    /// If true it applies damages and disable the Collider of the weapon
    /// </summary>
    /// <param name="other">is an Enemy (EntityLivingBase)</param>
    protected new void OnTriggerEnter(Collider other)
    {
        EntityLivingBase entityHit = other.gameObject.GetComponent <EntityLivingBase>();

        if (entityHit != null && entityHit.tag != "player")
        {
            _autoAttackWindiator.ApplyEffect(entityHit);
            _arme.enabled = false;
            colArme       = false;
        }
    }
Exemplo n.º 7
0
 public AIRoam(int _priority, EntityLivingBase _entity, float _roaming_space)
 {
     i_priority        = _priority;
     ent_main          = _entity;
     v3_spawn_position = new Vector3(0, 0, 0);
     s_ID               = "Movement";
     s_display_name     = "Roaming";
     b_is_interruptable = true;
     f_timer            = 0.0f;
     f_roaming_space    = _roaming_space;
 }
Exemplo n.º 8
0
    public AIAttackMelee(int _priority, EntityLivingBase _entity, System.Type _type, float _range)
    {
        i_priority         = _priority;
        ent_main           = _entity;
        s_ID               = "Combat";
        s_display_name     = "Melee Attack";
        b_is_interruptable = false;
        f_range            = _range;
        type_target        = _type;

        b_has_attacked = false;
    }
Exemplo n.º 9
0
    /** ApplyEffectOnHit, public void Method
     * @Params : EntityLivingBase
     * When the instance of FireBall hits an entity, this method is launched.
     * It applies damage and refresh Ignite on the target.
     **/
    public void ApplyEffectOnHit(EntityLivingBase entityHit)
    {
        entityHit.DamageFor(Damages[0]);
        IgniteStatus igniteStatus = entityHit.GetComponentInChildren <IgniteStatus>();

        if (igniteStatus != null)
        {
            igniteStatus.ResetStatus();
        }
        else
        {
            GameObject statusObj = ApplyStatus(Status[0], entityHit.transform);
            GetComponent <ConflagrationSpell>().Targets.Add(statusObj.GetComponent <IgniteStatus>());
        }
    }
Exemplo n.º 10
0
    /// <summary>
    /// OnTriggerEnter method from Unity called after a collision between two colliders
    /// the idea of a projectile is to check if the type of collision is type of EntityLivingBase
    /// In this case it launches the applyEffect implemented in the child Class
    /// In any type of collision the projectile will be destroyed at the end
    /// </summary>
    /// <param name="col">is the collider touch by the projectile</param>
    protected void OnTriggerEnter(Collider col)
    {
        if (!col.isTrigger)
        {
            eHit = col.gameObject.GetComponent <EntityLivingBase>();

            if (eHit != null && eHit.gameObject.tag != "player")
            {
                ApplyEffect(col);
            }

            AdditionalEffects();
            Destroy(gameObject);
        }
    }
Exemplo n.º 11
0
    /** Start private void
     * We get the prefab of the Ignite status and instantiate it on the target. We also get the prefab of all animations.
     * Then we invoke the Endstatus method which will destroy the debuff in a fixed amount of time (maxDuration).
     * Finally we launch an InvokeRepeating that will call the DamageFor method every _tickInterval.
     **/
    protected override void Start()
    {
        base.Start();

        ParticleSystem igniteParticules = GetComponent <ParticleSystem>();

        igniteParticules.Play();

        _entity    = GetComponentInParent <EntityLivingBase>();
        _explosion = (GameObject)Resources.Load("FireMage/ExplosionIgniteStatus", typeof(GameObject));

        float verticalPosition = transform.position.y + _entity.transform.lossyScale.y * 2;

        transform.position = new Vector3(transform.position.x, verticalPosition, transform.position.z);
    }
Exemplo n.º 12
0
    /// <summary>
    /// ApplyEffect, protected void method
    /// Used by the scripts attached to the weapon and deals damaged to the target
    /// Try also to apply the WindSpiritStatus to an ally
    /// </summary>
    /// <param name="hit">Enemy</param>
    public override void ApplyEffect(EntityLivingBase hit)
    {
        hit.DamageFor(Damages[0]);
        Debug.Log("Deal " + Damages[0] + " Damage point to " + hit.name);

        PassiveWindiator passive = GetComponent <PassiveWindiator>();

        if (hit.tag != "Player")
        {
            // Need table of player so I apply status on Windiator before new features
            passive.ProcPassive(this.gameObject);
        }

        if (_windiatorSimpleAttack.colArme)
        {
            _windiatorSimpleAttack.SwapEnableArmeCol();
        }
    }
Exemplo n.º 13
0
    /** OnAttackHit : public void Method
     * The OnAttackHit Method should be called by every AutoAttackFireMage prefabs when they collide an EntityLivingBase.
     * When this method is launched, we cancel the RemoveShield invoke in order to reset the timer of the shield associated to the entity.
     * Then, we add a shield to the FireMage and increase the shield value. Please note that the value should be increased by 5 points every hit, with a maximum of _maxValueShield.
     * After that, we re-invoke the RemoveShield method that will occurs in _maxDurationShield seconds.
     **/
    public void OnAttackHit(EntityLivingBase eHit)
    {
        int shieldValueToAdd  = int.Parse(OtherValues[0]);
        int maxValueShield    = int.Parse(OtherValues[1]);
        int maxDurationShield = int.Parse(OtherValues[2]);

        eHit.DamageFor(Damages[0]);
        CancelInvoke("RemoveShield");

        _shield = GetComponent <Shield>();
        if (_shield == null)
        {
            _shield         = gameObject.AddComponent <Shield>();
            _shieldInstance = Instantiate(_shieldObject, transform.position + _shieldObject.transform.position, transform.rotation, this.transform);
        }

        _shield.AddShieldValue(Mathf.Clamp(shieldValueToAdd, 0, maxValueShield - _shield.ShieldValue));
        Invoke("RemoveShield", maxDurationShield);
    }
Exemplo n.º 14
0
 /** ApplyEffect, protected void method
  *  This method is usually called by a prefab attach to th character who autoAttack to apply Damages and Effects
  *  In the mother Abstract class the method is empty in the case of nothing is apply to a prefab
  **/
 public virtual void ApplyEffect(EntityLivingBase hit)
 {
 }
Exemplo n.º 15
0
 /** ApplyAdditionalEffect, public void Method
  * @Params : EntityLivingBase
  * When the instance of SolarBurn hits the floor, an explosion occurs.
  * This method is called for every target that are caught by the Explosion.
  **/
 public void ApplyAdditionalEffect(EntityLivingBase entityHit)
 {
     entityHit.DamageFor(Damages[1]);
 }
Exemplo n.º 16
0
 /** ApplyEffectOnHit, public void Method
  * @Params : EntityLivingBase
  * When the instance of SolarBurn hits an entity, this method is launched.
  * It applies damages on the target.
  **/
 public void ApplyEffectOnHit(EntityLivingBase entityHit)
 {
     entityHit.DamageFor(Damages[0]);
 }
Exemplo n.º 17
0
 public EntityItem(Item item, EntityLivingBase owner) : base(new Rectangle[0])
 {
     this.Item  = item;
     this.Box   = new BoundingBox(this, item.Image.Width / 3, item.Image.Height / 3);
     this.owner = owner;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Strat method from Unity
 /// At the start, we just want to get the EntityLivingBase parent of the Status applied
 /// Needed this GameObject to interract with it after OnStatusApplied
 /// </summary>
 protected override void Start()
 {
     _entity = GetComponentInParent <EntityLivingBase>();
 }