// Update is called once per frame void Update() { if (Input.GetMouseButton(0)) { IFirearm firearm = equippedObject?.GetComponent <IFirearm>(); if (firearm != null) { firearm.Shoot(relMousePos); } } animator.SetFloat("facingY", relMousePos.y); animator.SetFloat("facingX", relMousePos.x); IItem item = equippedObject?.GetComponent <IItem>(); if (item != null) { float angle = Vector2.SignedAngle(Vector2.right, relMousePos); if (angle < 0.0f) { angle = 360.0f + angle; } item.Animate(angle); } }
public Shooter(IFirearm firearm) { _firearm = firearm; }