public void Initialize(Vector2 speed, float deflectionAngle) { Movable movable = GetComponent <Movable>(); movable.Speed = speed; movable.RotateSpeedVector(deflectionAngle); }
private void ChangePartSpeed(Asteroid part, int deflectionDirection) { float speedModifier = Random.Range(MinPartSpeedCoefficient, MaxPartSpeedCoefficient); float deflectionAngle = Random.Range(MinPartDeflectionAngle, MaxPartDeflectionAngle); Movable movableComponent = part.GetComponent <Movable>(); movableComponent.Speed = GetComponent <Movable>().Speed; movableComponent.IncreaseSpeedVector(speedModifier); movableComponent.RotateSpeedVector(deflectionAngle * deflectionDirection); }