/// <summary> /// Triggers the stay. /// </summary> /// <param name="my">My.</param> /// <param name="other">Other.</param> public void TriggerStay(Collider2D my, Collider2D other) { if (target == null) // Add new target to potential targets list { targetsList.Add(other.gameObject); } else // Attack current target { // If this is my current target if (target == other.gameObject) { if (my.name == "RangedAttack") // If target is in ranged attack range { // If I have ranged attack type if (rangedAttack != null) { // Remember my last attack type //myLastAttack = rangedAttack as IAttack; // Try to make ranged attack rangedAttack.Attack(other.transform); } } } } }
// Update is called once per frame void Update() { Update2(); //walkable.Walk(); attack.Attack(); }
// Update is called once per frame void Update() { //range = Mathf.Pow(transform.position.y, rngProp) + rngAdd; range = Mathf.Abs((int)(transform.position.y * rngProp + rngAdd)); dmg = Mathf.Abs((int)(transform.position.y * dmgProp + dmgAdd)); attack.dmg = dmg; attack.range = range; attack.speed = dmg; attack.Attack(); }
// Update is called once per frame void Update() { Update2(); range = Mathf.Pow(transform.position.y, rngProp) + 3; dmg = Mathf.Abs((int)(transform.position.y * dmgProp + 3)); attack.dmg = dmg; attack.range = range; attack.speed = dmg + 2; attack.Attack(); }
// Update is called once per frame void Update() { Update2(); //float distanceBetween2 =attack.FindClosestTarget(); //GameObject enemy= attack.GetClosestTarget(); //float distanceBetween = transform.position.x - enemy.transform.position.x; //attack.speed = distanceBetween2/2; range = Mathf.Pow(transform.position.y, rngProp) + 3; dmg = Mathf.Abs((int)(transform.position.y * dmgProp + 5)); attack.dmg = dmg; attack.range = range; attack.speed = dmg + 2; attack.Attack();//if ground }