BIG UPDATE: Added Shoot Effect and models
This commit is contained in:
31
Assets/Scripts/MainMenu/Screenshot.cs
Normal file
31
Assets/Scripts/MainMenu/Screenshot.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Screenshot : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.P))
|
||||
{ // capture screen shot on left mouse button down
|
||||
|
||||
string folderPath = "Assets/Screenshots/"; // the path of your project folder
|
||||
|
||||
if (!System.IO.Directory.Exists(folderPath)) // if this path does not exist yet
|
||||
System.IO.Directory.CreateDirectory(folderPath); // it will get created
|
||||
|
||||
var screenshotName =
|
||||
"Screenshot_" +
|
||||
System.DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss") + // puts the current time right into the screenshot name
|
||||
".png"; // put youre favorite data format here
|
||||
ScreenCapture.CaptureScreenshot(System.IO.Path.Combine(folderPath, screenshotName), 2); // takes the sceenshot, the "2" is for the scaled resolution, you can put this to 600 but it will take really long to scale the image up
|
||||
Debug.Log(folderPath + screenshotName); // You get instant feedback in the console
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/MainMenu/Screenshot.cs.meta
Normal file
11
Assets/Scripts/MainMenu/Screenshot.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d3be27722d62464fb70b9c80c9ba688
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -101,4 +101,8 @@ public class PlayerComponent : MonoBehaviour
|
||||
health -= damage;
|
||||
if (applyShake) ShakeCamera(15, 5);
|
||||
}
|
||||
public void ShootEffect()
|
||||
{
|
||||
ShakeCamera(1, 2);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class PlayerInteractionHandler : MonoBehaviour
|
||||
@ -45,6 +46,8 @@ public class PlayerInteractionHandler : MonoBehaviour
|
||||
|
||||
public Transform CarryingPos => carryingPos;
|
||||
|
||||
public UnityEvent onFire;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
@ -82,6 +85,7 @@ public class PlayerInteractionHandler : MonoBehaviour
|
||||
pistol.Fire();
|
||||
noiseManager.ShotFired();
|
||||
tempInvent.Remove(pistol.projectileName);
|
||||
onFire.Invoke();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user