private bool SetActionIfNotAmbiguous(string curArg, OptionsAction action) { if (_action == action) { return(true); } if (_action != OptionsAction.None) { _action = OptionsAction.ShowHelp; ErrorMessage = $"Options are mutually exclusive: {_actionArg} and {curArg}."; ResultCode = ResultCodes.InvalidArguments; return(false); } _action = action; _actionArg = curArg; return(true); }
private OptionsAction CreateActionSprite() { GameObject actionObject = new GameObject(name + " Action"); actionObject.AddComponent <SpriteRenderer>(); actionObject.AddComponent <CircleCollider2D>(); actionObject.AddComponent <OptionsAction>(); actionObject.transform.parent = actionSpriteRoot.transform; // Relative to root actionObject.transform.localScale = new Vector2(spriteScale, spriteScale); actionObject.GetComponent <SpriteRenderer>().sortingLayerName = "WorldUI"; // Make sure this renders in the UI layer CircleCollider2D collider = actionObject.GetComponent <CircleCollider2D>(); collider.isTrigger = true; collider.radius = 1; OptionsAction optionsAction = actionObject.GetComponent <OptionsAction>(); optionsAction.character = this; return(optionsAction); }