Skip to content

Instantly share code, notes, and snippets.

View TheMehranKhan's full-sized avatar

Mehran TheMehranKhan

View GitHub Profile
@TheMehranKhan
TheMehranKhan / dropbox-redirect.html
Last active June 3, 2023 17:33 — forked from mds/dropbox-redirect.html
A Simple JS Redirect
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- Replace with your own title -->
<title>Redirecting to old website...</title>
<script>
// Add your own shareable dropbox link
window.location.replace("https://tehmarkaz.framer.website");
</script>
/*
## Open [https://scriptkit.com/scripts](https://scriptkit.com/scripts)
Browse scripts contribued by the Script Kit community. 🎉
To share your own script, post to our Script Kit GitHub Discussions:
[https://github.com/johnlindquist/kit/discussions](https://github.com/johnlindquist/kit/discussions)
*/
@TheMehranKhan
TheMehranKhan / HealthBar.cs
Created October 27, 2023 20:34
A health bar that is represented by a slider UI element.
// Author: themehrankhan
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// A health bar that is represented by a slider UI element.
/// It can be used to display the player's current health in the game.
///
/// To use the health bar, simply attach this script to a game object in your scene
@TheMehranKhan
TheMehranKhan / LocationBasedGame.cs
Created October 27, 2023 20:36
A location-based game that uses Mapbox to check if the player is within a target radius.
using UnityEngine;
using Mapbox.Unity.Map;
using Mapbox.Unity.Location;
/// <summary>
/// A location-based game that uses Mapbox to check if the player is within a target radius.
/// </summary>
public class LocationBasedGame : MonoBehaviour
{
/// <summary>
@TheMehranKhan
TheMehranKhan / GameOverManager.cs
Created October 27, 2023 20:37
A game over manager that is responsible for showing the game over UI and handling game restart.
// Author: themehrankhan
using UnityEngine;
using UnityEngine.SceneManagement;
/// <summary>
/// A game over manager that is responsible for showing the game over UI and handling game restart.
///
/// This manager can be used to centralize the game's game over logic, making it easier to maintain and update.
///
@TheMehranKhan
TheMehranKhan / CollectibleItem.cs
Created October 27, 2023 20:38
A collectible item that gives points to the player's score when the player collides with it.
// Author: themehrankhan
using UnityEngine;
/// <summary>
/// A collectible item that gives points to the player's score when the player collides with it.
/// </summary>
public class CollectibleItem : MonoBehaviour
{
/// <summary>
@TheMehranKhan
TheMehranKhan / ScoreManager.cs
Created October 27, 2023 20:47
Keeps track of the player's score and updates a score text UI element.
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Keeps track of the player's score and updates a score text UI element.
///
/// This script can be used to centralize the game's score logic, making it easier to maintain and update.
///
/// To use the score manager, simply attach this script to a game object in your scene
/// and assign the score text UI element to the `scoreText` public property.
@TheMehranKhan
TheMehranKhan / CameraFollow.cs
Created October 27, 2023 20:50
This code block provides a camera follow functionality in Unity. It allows the camera to smoothly follow the player object.
/*
Author: themehrankhan
License: MIT License
Description:
This code block provides a camera follow functionality in Unity. It allows the camera to smoothly follow the player object.
Usage:
1. Attach this script to the camera object in Unity.
2. Set the target object (player object) in the inspector.
@TheMehranKhan
TheMehranKhan / PlayerMovement.cs
Created October 27, 2023 20:51
This code block provides a basic player movement functionality in Unity. It allows the player to move forward, backward, left, and right using the arrow keys or WASD keys.
/*
Author: themehrankhan
License: MIT License
Description:
This code block provides a basic player movement functionality in Unity. It allows the player to move forward, backward, left, and right using the arrow keys or WASD keys.
Usage:
1. Attach this script to the player object in Unity.
2. Ensure the player object has a Rigidbody component attached.
@TheMehranKhan
TheMehranKhan / EnemyAI.cs
Created October 27, 2023 20:51
This code block provides a basic enemy AI functionality in Unity. It allows the enemy to follow and attack the player.
/*
Author: themehrankhan
License: MIT License
Description:
This code block provides a basic enemy AI functionality in Unity. It allows the enemy to follow and attack the player.
Usage:
1. Attach this script to the enemy object in Unity.
2. Set the player object in the inspector.