public void Teleport(Point _point, bool _from) { if (isPowered) { List <CouchCrewScript> _crewList = new List <CouchCrewScript>(); if (_from) { List <HealthScript> _hList = room.GetAllHScr(); //List<CouchCrewScript> _crewList = new List<CouchCrewScript>(); foreach (var _hScr in _hList) { //_crewList.Add(_hScr.GetComponent<CrewScript>()); CouchCrewScript _crew = _hScr.GetComponent <CouchCrewScript>(); _crewList.Add(_crew); //_crew.Teleport(_point); might've caused issues? } } else { RoomScript _room = LevelManager.Instance.Tiles[_point].transform.GetChild(0).GetChild(0).GetComponent <RoomScript>(); RoomScript _roomOrig = _room.GetOriginObj().GetComponent <RoomScript>(); List <HealthScript> _hList = _room.GetAllHScr(); //List<CouchCrewScript> _crewList = new List<CouchCrewScript>(); _point = room.GridPos; foreach (var _hScr in _hList) { //_crewList.Add(_hScr.GetComponent<CrewScript>()); CouchCrewScript _crew = _hScr.GetComponent <CouchCrewScript>(); _crewList.Add(_crew); //_crew.Teleport(_point); might've caused issues? } } foreach (var _crew in _crewList) { _crew.Teleport(_point); } } else { Debug.LogError("porter aint powered!"); } }
private void SwitchCrewTarget(int _amount) { List <HealthScript> _hScrList = currentRoom.GetAllHScr(); Debug.Log("hScrCount: " + _hScrList.Count + ", count: " + targetCount); if (_hScrList.Count > 0) { targetCount += _amount; if (targetCount < 0) { targetCount = (_hScrList.Count - 1); } else if (targetCount >= _hScrList.Count) { targetCount = 0; } /* * //add and remove aggressor from target //for room evac * targetHScr.AggressorList.Remove(this); * targetHScr = _hScrList[targetCount]; * targetHScr.AggressorList.Add(this); */ if (targetHScr == hScr) { Debug.Log("ye shootin yerself!"); //targetHScr = _hScrList[targetCount]; //targetHScr.AggressorList.Remove(this); //commented out for debug! //SwitchCrewTarget(_amount); } else { //Debug.Log("ye shootin yerself!"); targetHScr.AggressorList.Remove(this); //add and remove aggressor from target //for room evac //targetHScr.AggressorList.Remove(this); //targetHScr = _hScrList[targetCount]; //targetHScr.AggressorList.Add(this); } targetHScr = _hScrList[targetCount]; if (targetHScr == hScr) { } else { targetHScr.AggressorList.Add(this); } } else { } /* else { * Debug.Log("you're the only one here"); * * //debug * targetCount += _amount; * * if (targetCount < 0) { * targetCount = (_hScrList.Count - 1); * * } * else if (targetCount >= _hScrList.Count) { * targetCount = 0; * } * * //add and remove aggressor from target //for room evac * targetHScr.AggressorList.Remove(this); * targetHScr = _hScrList[targetCount]; * targetHScr.AggressorList.Add(this); * * * if (targetHScr == hScr) { * Debug.Log("ye shootin yerself!"); * * //commented out for debug! * //SwitchCrewTarget(_amount); * } * } * * * /* * HealthScript[] _hScrArr = new HealthScript[_hScrList.Count]; * foreach (var _hScr in _hScrList) * { * * } */ }