This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExecuteInEditMode] | |
[SelectionBase] | |
public class CubeEditor : MonoBehaviour | |
{ | |
[SerializeField][Range(1f, 20f)] float gridSize = 10f; | |
TextMesh textMesh; | |
private void Start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class EnemyMovement : MonoBehaviour | |
{ | |
[SerializeField] List<Waypoint> path; | |
void Start() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SerializeField][Range(1f, 20f)] float gridSize = 10f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RequireComponent(typeof(Waypoint))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Debug.LogWarning("This is text of warning!"); //loging a Warning |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MeshRenderer topMeshRenerer = transform.Find("Top").GetComponent<MeshRenderer>(); | |
topMeshRenerer.material.color = color; | |
//Note : Children children, not children of children’s. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void KillEnemy() | |
{ | |
ParticleSystem vfx = Instantiate(deathParticlePrefab, transform.position, Quaternion.identity); | |
vfx.Play(); | |
float destroyDelay = vfx.main.duration; | |
Destroy(vfx.gameObject, destroyDelay); | |
//destroy patciles | |
Destroy(gameObject); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SerializeField] GameObject towerParentTransform; | |
private void InstantiateNewTower(Waypoint baseWaypoint) | |
{ | |
var newTower = Instantiate(towerPrefab, baseWaypoint.transform.position, Quaternion.identity); | |
newTower.transform.parent = towerParentTransform.transform; //THIS LINE | |
} | |
//or better |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.AI; | |
public class EnemyAI : MonoBehaviour | |
{ | |
[SerializeField] Transform target; // We care where player is. | |
NavMeshAgent navMeshAgent; | |
// Start is called before the first frame update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Weapon : MonoBehaviour | |
{ | |
[SerializeField] Camera FPCamera; | |
[SerializeField] float range = 100f; | |
[SerializeField] float damage = 30f; | |
void Update() | |
{ | |
if(Input.GetButtonDown("Fire1")) | |
{ | |
Shoot(); |