public static bool CompleteGoal(GameEntity company, GameContext gameContext, InvestmentGoal goal, bool forceComplete = false) { //Companies.Log(company, "Try complete goal: " + goal.GetFormattedName()); bool willComplete = forceComplete || CanCompleteGoal(company, gameContext, goal); if (willComplete) { Companies.LogSuccess(company, $"Completed goal: {goal.GetFormattedName()}"); var executor = GetExecutor(goal, company, gameContext); CompleteGoal2(executor, goal); if (goal.NeedsReport) { var controller = GetController(goal, company, gameContext); CompleteGoal2(controller, goal); } } //else //{ // Companies.Log(company, "Not all requirements were met (\n\n" + goal.GetFormattedRequirements(company, gameContext)); //} return(willComplete); }
public override string GetButtonTitle() { if (Goal == null) { return(""); } return(Goal.GetFormattedName()); }
public static void AddCompanyGoal(GameEntity company, GameContext gameContext, InvestmentGoal goal) { var executor = GetExecutor(goal, company, gameContext); var controller = GetController(goal, company, gameContext); if (goal.NeedsReport) { AddCompanyGoal2(executor, goal); AddCompanyGoal2(controller, goal); Companies.Log(executor, "ADD GOAL " + goal.GetFormattedName() + " as executor"); Companies.Log(controller, "ADD GOAL " + goal.GetFormattedName() + " as controller"); } else { Companies.Log(executor, "ADD GOAL " + goal.GetFormattedName() + " as executor && controller"); AddCompanyGoal2(executor, goal); } }
public override void ViewRender() { base.ViewRender(); Draw(PickButton, true); Draw(Requirements, true); Title.text = InvestmentGoal.GetFormattedName(); Requirements.text = Investments.GetFormattedRequirements(InvestmentGoal, MyCompany, Q); Number.text = $"#{index + 1}"; }
public override void ViewRender() { base.ViewRender(); var company = MyCompany; var executor = Companies.Get(Q, InvestmentGoal.ExecutorId); bool completed = Investments.CanCompleteGoal(executor, Q, InvestmentGoal); Draw(CompleteButton, completed); Draw(Requirements, !completed); Draw(ProgressImage, !completed); Title.text = InvestmentGoal.GetFormattedName(); Requirements.text = Investments.GetFormattedRequirements(InvestmentGoal, executor, Q); Number.text = $"#{index + 1}"; //var requirements = InvestmentGoal.GetGoalRequirements(executor, Q); //var progress = InvestmentGoal.GetGoalProgress(executor, Q) / 100f; //ProgressImage.fillAmount = progress; }