zombie_mp/Assets/Scripts/redDotBehaviour.cs
2021-11-13 18:59:45 +05:30

28 lines
705 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HQFPSWeapons;
public class redDotBehaviour : MonoBehaviour
{
public Player player;
public Material redDotMaterial;
public weaponAttachmentsMgr attachmentsMgr;
void Start()
{
player.Aim.AddStartListener(OnAimStart);
player.Aim.AddStopListener(OnAimStop);
}
void Update() {
redDotMaterial.color = new Color(redDotMaterial.color.r, redDotMaterial.color.g, redDotMaterial.color.b, attachmentsMgr.aimed);
}
void OnAimStart(){
attachmentsMgr.focus(true);
}
void OnAimStop(){
attachmentsMgr.focus(false);
}
}