コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     duration      -= Time.deltaTime;
     timeSinceTick += Time.deltaTime;
     if (obj != null && timeSinceTick > .5f)
     {
         obj.TakeDamage(damageValue, ElementalResistances.FIRE);
         Collider2D[] nearby = Physics2D.OverlapCircleAll(transform.position, 1.75f);
         Ability.DebugDrawRadius(transform.position, 1.75f, Color.red, .35f);
         foreach (Collider2D coll in nearby)
         {
             if (coll.transform.root.GetComponent <EnemyObject>() != null && coll.transform.root.GetComponent <WildfireDot>() == null)
             {
                 WildfireDot spreadDot = coll.transform.root.gameObject.AddComponent <WildfireDot>();
                 spreadDot.duration    = duration;
                 spreadDot.damageValue = damageValue * 1.5f;
                 spreadDot.burnCount   = burnCount + 1;
             }
         }
         timeSinceTick = 0;
     }
     if (duration < 0)
     {
         Destroy(this);
     }
 }
コード例 #2
0
    private void OnTriggerEnter2D(Collider2D coll)
    {
        EnemyObject obj = coll.transform.root.GetComponent <EnemyObject>();

        if (obj != null)
        {
            obj.TakeDamage(damageValue, damageType);
        }
        Destroy(gameObject);
    }
コード例 #3
0
 // Update is called once per frame
 void Update()
 {
     Duration        -= Time.deltaTime;
     internalCounter += Time.deltaTime;
     if (internalCounter > .25f)
     {
         attached.TakeDamage(DamagePerSecond * .125f, ElementalResistances.POISON);
         internalCounter = 0;
     }
     if (Duration <= 0)
     {
         Destroy(this);
     }
 }
コード例 #4
0
ファイル: Sword.cs プロジェクト: Rernokk/PrimalForge-Source
 public override void PrimaryAttack(Vector2 pos)
 {
     Collider2D[] hits = Physics2D.OverlapCircleAll(Player_Accessor_Script.DetailsScript.transform.position, 1.5f);
     for (int i = 0; i < hits.Length; i++)
     {
         if (Vector3.Dot((hits[i].transform.position - Player_Accessor_Script.DetailsScript.transform.position).normalized, Camera_Controller_Script.CalculateVectorFromPlayerToMouse()) > .7)
         {
             EnemyObject obj = hits[i].GetComponent <EnemyObject>();
             if (obj != null)
             {
                 obj.TakeDamage(3f, ElementalResistances.PHYSICAL);
             }
         }
     }
 }
コード例 #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (firstStage)
     {
         EnemyObject obj = collision.transform.root.GetComponent <EnemyObject>();
         if (obj != null)
         {
             obj.TakeDamage(damageVal, ElementalResistances.FIRE);
         }
     }
     else
     {
         EnemyObject obj = collision.transform.root.GetComponent <EnemyObject>();
         if (obj != null)
         {
             obj.TakeDamage(damageVal * 1.4f, ElementalResistances.FIRE);
         }
     }
 }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        if (count < maxCount)
        {
            StartCoroutine(DelayedWave());
        }
        else
        {
            StartCoroutine(DelayedDestroy());
        }
        LightCamShake();

        foreach (Collider2D coll in Physics2D.OverlapCircleAll(transform.position, .5f))
        {
            EnemyObject obj = coll.transform.root.GetComponent <EnemyObject>();
            if (obj != null)
            {
                obj.TakeDamage(damageVal, damageType);
            }
        }
    }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        tickCycle += Time.deltaTime;
        if (tickCycle > tickMax)
        {
            tickCycle -= tickMax;
            Collider2D[] colls = Physics2D.OverlapCircleAll(transform.position, radius);
            foreach (Collider2D coll in colls)
            {
                EnemyObject obj = coll.transform.root.GetComponent <EnemyObject>();
                if (obj != null)
                {
                    obj.TakeDamage(damagePerTick, damageType);
                }
            }
        }

        remDur -= Time.deltaTime;
        if (remDur < 0)
        {
            Destroy(gameObject);
        }
    }
コード例 #8
0
    void Update()
    {
        base.Update();

        if (target == null)
        {
            Collider2D[] area = Physics2D.OverlapCircleAll(transform.position, 15f, LayerMask.GetMask("Enemies"));
            if (area.Length > 0)
            {
                target      = area[0].GetComponent <EnemyObject>();
                currentPath = AIManager.instance.Dijkstra(transform.position, target.transform.position);
            }
        }
        else
        {
            if (Vector2.Distance(transform.position, target.transform.position) < .25f)
            {
                if (attackTimer <= 0)
                {
                    target.TakeDamage(1f, ElementalResistances.PHYSICAL);
                    attackTimer = 1f;
                }
                else
                {
                    attackTimer -= Time.deltaTime;
                }
            }
            else if (currentPath.Count > 0)
            {
                transform.position += (new Vector3(currentPath[0].x, currentPath[0].y) - transform.position).normalized * Time.deltaTime * 3f;
                if (Vector3.Distance(transform.position, new Vector3(currentPath[0].x, currentPath[0].y)) < .25f)
                {
                    currentPath.RemoveAt(0);
                }
            }
        }
    }
コード例 #9
0
 private void Start()
 {
     attached = transform.root.GetComponent <EnemyObject>();
     attached.TakeDamage(DamagePerSecond * .125f, ElementalResistances.POISON);
     originalDuration = Duration;
 }