public void Reclaim(WayPointWalker enemy) { Debug.Assert(enemy.OriginFactory == this, "Wrong factory reclaimed!"); if (pools == null) { CreatePools(); } pools[enemy.Id].Add(enemy); enemy.gameObject.SetActive(false); }
void Awake() { Enemy = transform.root.GetComponent <WayPointWalker>(); Debug.Assert(Enemy != null, "Target point without Enemy root!", this); Debug.Assert( GetComponent <BoxCollider2D>() != null, "Target point without collider!", this ); Debug.Assert(gameObject.layer == 8, "Target point on wrong layer!", this); }
public QuantumData(int iPathIndex, float fPathOffsetX, float fPathOffsetZ, int iAIIndex, float fSpeed, bool bhasPath = true) { _PathIndex = iPathIndex; _OffsetX = fPathOffsetX; _OffsetZ = fPathOffsetZ; _Speed = fSpeed; _AIIndex = iAIIndex; if(bhasPath) { _Walker = new WayPointWalker(fSpeed, iPathIndex); } _HasPath = bhasPath; _Colour = new Vector3(1.0f,1.0f,1.0f); _Selected = new Vector3(1.0f,0.0f,1.0f); _BeenSelected = false; BuildHandle(); }
private void PathEditor() { if(_PatheEditor) { Ray ray; RaycastHit hit; Vector3 vPos = _CameraPos; vPos.y += 15.0f; _CameraTrans.position = vPos; Vector3 vPoint = _Walker.Walk(Time.deltaTime); _PF._X = vPoint.x; _PF._Z = vPoint.z; if(Input.GetMouseButton(0)) { _WayPointDatabase.MouseDown(); } else { _WayPointDatabase.MouseUp(); } ray = _Camera.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, out hit, 200)) { if(hit.transform.gameObject.name == "Ground") { _WayPointDatabase.Mouse(hit.point.x,hit.point.z); } } if(Input.GetKeyDown(KeyCode.A)) { _WayPointDatabase.AddPoint(); } if(Input.GetKeyDown(KeyCode.D)) { _WayPointDatabase.DeletePoint(); } // Exit the path editor if(Input.GetKeyDown(KeyCode.P)) { _PatheEditor = false; Sprite.Kill(_PF); _Walker = null; _Number.SetNumber(_LocalHiScore); SetScreen("TITLE"); return; } /* if(Input.GetKeyDown(KeyCode.S)) { _WayPointDatabase.Save(); } if(Input.GetKeyDown(KeyCode.L)) { //_WayPointDatabase.Load(); } */ if(Input.GetKeyDown(KeyCode.Z)) { if(Input.GetKey(KeyCode.LeftShift)) { for(int i = 0; i < 10; ++i) { _WayPointDatabase.Previous(); } } else { _WayPointDatabase.Previous(); } _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); } if(Input.GetKeyDown(KeyCode.X)) { if(Input.GetKey(KeyCode.LeftShift)) { for(int i = 0; i < 10; ++i) { _WayPointDatabase.Next(); } } else { _WayPointDatabase.Next(); } _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); } // Add a new path onto the end of the list if(Input.GetKeyDown(KeyCode.N)) { _WayPointDatabase.New(); _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); } if(Input.GetKeyDown(KeyCode.I)) { _WayPointDatabase.NewInsert(); _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); } if(Input.GetKeyDown(KeyCode.E)) { _WayPointDatabase.ErasePath(); _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); } if(Input.GetKeyDown(KeyCode.C)) { _WPCopyBuffer = _Walker._WayPoints; } if(Input.GetKeyDown(KeyCode.V)) { if(_WPCopyBuffer == null) { return; } _WayPointDatabase.NewInsert(); _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); _Walker._WayPoints.Copy(_WPCopyBuffer); } if(Input.GetKeyDown(KeyCode.B)) { if(_WPCopyBuffer == null) { return; } _WayPointDatabase.New(); _Walker = new WayPointWalker(0.3f,_WayPointDatabase._CurrentIndex); _Walker._WayPoints.Copy(_WPCopyBuffer); } if(Input.GetKey(KeyCode.UpArrow)) { if(_Walker != null) { if(Input.GetKey(KeyCode.LeftShift)) { _Walker._WayPoints.MarchUp(1.0f); } else { _Walker._WayPoints.MarchUp(10.0f); } } } if(Input.GetKey(KeyCode.DownArrow)) { if(_Walker != null) { if(Input.GetKey(KeyCode.LeftShift)) { _Walker._WayPoints.MarchDown(1.0f); } else { _Walker._WayPoints.MarchDown(10.0f); } } } if(Input.GetKey(KeyCode.LeftArrow)) { if(_Walker != null) { if(Input.GetKey(KeyCode.LeftShift)) { _Walker._WayPoints.MarchLeft(1.0f); } else { _Walker._WayPoints.MarchLeft(10.0f); } } } if(Input.GetKey(KeyCode.RightArrow)) { if(_Walker != null) { if(Input.GetKey(KeyCode.LeftShift)) { _Walker._WayPoints.MarchRight(1.0f); } else { _Walker._WayPoints.MarchRight(10.0f); } } } if(Input.GetKeyDown(KeyCode.R)) { _Walker._WayPoints.Reverse(); } if(Input.GetKeyDown(KeyCode.F)) { _Walker._WayPoints.Reverse(); _Walker._WayPoints.MirrorX(); } if(Input.GetKeyDown(KeyCode.G)) { _Walker._WayPoints.MirrorZ(); } _WayPointDatabase.DebugDraw(); _Number.SetNumber(_WayPointDatabase._CurrentIndex); } }
public AI() { _Walker = new WayPointWalker(); }