Pracownia-Programowania-Pro.../Assets/Scripts/MouseCursor.cs
Polarjad 97b7b765fd Added enemy AI
Added wip sprites for map, changed shooting, added 2 different enemy AI, added health system
2021-01-13 18:58:14 +01:00

30 lines
692 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseCursor : MonoBehaviour
{
private SpriteRenderer rend;
public Sprite clickedCursor;
public Sprite normalCursor;
void Start()
{
Cursor.visible = false;
rend = GetComponent<SpriteRenderer>();
}
void Update()
{
Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.position = cursorPos;
if (Input.GetMouseButtonDown(0))
{
rend.sprite = clickedCursor;
}
else if (Input.GetMouseButtonUp(0))
{
rend.sprite = normalCursor;
}
}
}