private void FixedUpdate() { Rigidbody2D rb = GetComponent <Rigidbody2D>(); float driftFactor = _driftSticky; if (RightVelocity.magnitude > _maxVelocity) { driftFactor = _driftSlippy; } rb.velocity = ForwardVelocity + RightVelocity * driftFactor; if (_accelerate) { rb.AddForce(transform.up * _speed); } if (_brake) { rb.AddForce(transform.up * -_speed); } float tf = Mathf.Lerp(0, _torque, rb.velocity.magnitude / 2); rb.angularVelocity = _angular * tf; OutOfScreen.CheckOutOfScreen(transform); }
public override void _Process(float delta) { if (Position.x + Camera.ScreenSize.x < Camera.Position.x) { OutOfScreen?.Invoke(this); QueueFree(); } }
void CheckOutOfScreen() { if (transform.position.y < bottomY) { isActivated = false; OutOfScreen?.Invoke(this); } }
public LevelOfDetail(Animal animal) { _gO = animal.gameObject; _type = H.Animal; _geometry = animal.Geometry; _outOfScreen = new OutOfScreen(animal); SetLOD(); }
public LevelOfDetail(Person person) { _gO = person.gameObject; _type = H.Person; _geometry = person.Geometry; _outOfScreen = new OutOfScreen(person); SetLOD(); }
private void Start() { outOfScreen = GetComponent <OutOfScreen>(); }