public GameBattle() { this.level = new GameLevel(); this.map = new GameMap(); this.actorMgr = new ActorMgr(); this.collision = new ActorCollisionPrecessor(); this.gameUIEvent = new GameUIEventReciever(); this.mapNodeCenter = new MapNodeCenter(); }
void FixedUpdate() { foreach (KeyValuePair <string, GameObject> pair in _dic) { Transform t = pair.Value.transform; GameObject obj = pair.Value; if (t.localPosition.y > 1) { t.localPosition = new Vector3(t.localPosition.x, 1, t.localPosition.z); CollideBoardCtrl ctrl = obj.GetComponent <CollideBoardCtrl>(); ctrl.enemyOn(false); ctrl.operatorOn(false); } } MapNodeCenter center = RhodesGame.Instance.battle.mapNodeCenter; foreach (IntVec point in center.LoadedNodes) { string key = point.toKey(); if (center[point, ActorType.ANY].Count > 0) { if (!_dic.ContainsKey(key)) { GameObject obj = Instantiate(prefab, GlobalGameObject.BattleFieldOriginal.transform); obj.transform.localPosition = new Vector3(point.x, 1, point.y); _dic.Add(key, obj); } Transform t = _dic[key].transform; t.localPosition = new Vector3(t.localPosition.x, 2, t.localPosition.z); } if (center[point, ActorType.OPERATOR].Count > 0) { _dic[key].GetComponent <CollideBoardCtrl>().operatorOn(true); } if (center[point, ActorType.MONSTER].Count > 0) { _dic[key].GetComponent <CollideBoardCtrl>().enemyOn(true); } } // foreach(IntVec vec in _map){ // string key = vec.toKey(); // if (!_dic.ContainsKey(key)) { // GameObject obj = Instantiate(prefab, origin.transform); // obj.transform.localPosition = new Vector3(vec.x, 1, vec.y); // _dic.Add(key, obj); // } // Transform t = _dic[key].transform; // t.localPosition = new Vector3(t.localPosition.x, 2, t.localPosition.z); // } }