static public float SafeTextToFloat(string text) { float res; if (float.TryParse(text, out res)) { return(res); } ExtLog.AddLine("Failed to convert value: " + text); return(0.0f); }
static public int SafeTextToInt(string text) { int res; if (int.TryParse(text, out res)) { return(res); } ExtLog.AddLine("Failed to convert value: " + text); return(0); }
/// <summary> /// call here when another Box is collider with us /// </summary> /// <param name="other"></param> public void CollideWithOtherBox() { //no collision with box if (_onCollisionObject.ListRigidBodyBox.Count == 0) { return; } ExtLog.LogList(_onCollisionObject.ListRigidBodyBox); Aglomera other = IsOtherInAglomera(); //collision with box if (AglomeraRef == null && other == null) { if (IsPressingA || IsOtherBoxIsPressingA()) { //here do nothing ! ye pressing action ! return; } Debug.Log("create an aglometa !"); AglomeraRef = _aglomeraManager.CreateAglomera(_onCollisionObject.ListRigidBodyBox); } else { if (AglomeraRef == null) { //here we are NOT in an aglorema, but other does if (IsPressingA) { //here do nothing ! ye pressing action ! return; } AglomeraRef = other; AglomeraRef.AddThisBoxToOurAglomera(_onCollisionObject); } else { //here we are inside the aglomera, try to add all other box in collision ExtLog.LogList(_onCollisionObject.ListRigidBodyBox); AglomeraRef.AddBoxToOurAglomera(_onCollisionObject.ListRigidBodyBox); } } }