摘要:public void BuildMap(){ m_map = new MapData(MapSizeX, MapSizeZ); for(int i=0; i(); Vector3 pos = nodeobj.transform.position; if((int)pos.x >= MapSizeX || (int)pos.z >= MapSizeZ) { continue; } m_map[(int)pos.x, (int)pos.z].fieldtype = node._mapData.fieldtype;}
阅读全文
摘要:[System.Serialzable]public class MapData{ public enum FieldTypeID { GuardPosition, CanNotStand, } public FieldTypeID fieldtype = FieldTypeID.GuardPosition;}public class GridNode : MonoBehaviour{ public MapData _mapData; void OnDrawGizmos() { Gizmos.DrawIcon(this.transform....
阅读全文
摘要:float height = 0;for(int i=0; i<MapSizeX; i++){ Gizmos.DrawLine(new Vector3(i, height, 0), new Vector3(i, height, MapSizeZ));}for(int k=0; k<MapSizeZ; k++){ Gizmos.DrawLine(new Vector3(0, height, k), new Vector3(MapSizeX, height, k));}DrawLine 绘制 横线x,y,z
阅读全文
摘要:void OnTriggerEnter(Collider other) { if(other.tag.Compare("PlayerRocket") == 0) { Rocket rocket = other.GetComponent(); if(rocket != null) { m_life -= rocket.m_power; if(m_life <= 0) { Destory(this.gameObject); } else i...
阅读全文
摘要:1 public float m_speed = 10; 2 public float m_liveTime = 1; 3 public float m_power = 1.0f; 4 protected Transform m_transform; 5 6 void Start() { 7 m_transform = this.transform; 8 } 9 10 void Update() {11 m_liveTime -= Time.deltaTime;12 if(m_liveTime <= 0) 13 {14 Destory(this.gameObject)...
阅读全文
摘要:void update(){ float movev = 0; float moveh = 0; if(Input.GetKey(KeyCode.UpArrow)) { movev -= m_speed*Time.deltaTime; } if(Input.GetKey(KeyCode.DownArrow)) { movev += m_speed*TimedeltaTime; } if(Input.GetKey(KeyCode.LeftArrow)) { moveh += m_speed*TimedeltaTime; } if(Input.GetK...
阅读全文