// Update is called once per frame private void Update() { if (_casted) { transform.position = Vector3.Lerp(transform.position, _orbPosition, Time.deltaTime * 5); } if (_splitting) { if (Count <= SpellLevel * 2) { var x = Instantiate(this); x.CastOrigin = CastOrigin; x.Count++; _splitting = false; _shooting = true; } } if (_shooting) { if (_target == null) { _target = ProximityProvider.FindClosestEnemyAsPlayer(CastOrigin); } else { transform.position = Vector3.MoveTowards(transform.position, _target.transform.position, Time.deltaTime * 100); } } }
private void Update() { if (_moovingOverHead) { transform.position = Vector3.Lerp(transform.position, _overHeadPosition, Time.deltaTime * 5); } if (_splitting) { if (Count <= SpellLevel * 2) { var x = Instantiate(this); x.SpellLevel = SpellLevel; x.CastOrigin = CastOrigin; x.Count++; _splitting = false; _shooting = true; } } if (_shooting) { if (_target == null) { _target = ProximityProvider.FindClosestEnemyAsPlayer(CastOrigin); //Debug.Log("Found a target " + _target.gameObject.tag); } else { //transform.LookAt(_target.transform); //transform.Translate(_target.transform.position * Time.deltaTime * 50); //transform.RotateAround(transform.position, Vector3.down, 12f); //_rb.AddForce((_target.transform.position - transform.position) * Speed); transform.position = Vector3.MoveTowards(transform.position, _target.transform.position, Time.deltaTime * 100); } //Debug.Log("Moving to " + _target.transform.position); //transform.position = Vector3.MoveTowards(transform.position, _target.transform.position, Time.deltaTime * 100); } }