public virtual void Update() { animations.Update(); progress.Update(); progress.position = position + new Vector2(0, height); progress.HP(information.HitPoints, information.HitPointsTotal); if (ui != null) { ui.Update(); } if (information.HitPoints > 0) { if (transition) { UpdateTransition(); if (target != null) { int adjustX = ((int)target.position.X - (int)position.X) / 32; int adjustY = ((int)target.position.Y - (int)position.Y) / 32; if (Math.Abs(adjustX) > information.Range || Math.Abs(adjustY) > information.Range) { transition = false; } } } else if (animations.currentAnimation != AnimationType.DYING) { animations.Stop(); } } if (animations.currentAnimation != AnimationType.DYING && information.HitPoints <= 0) { selected = false; animations.currentAnimation = AnimationType.DYING; animations.isLooping = false; animations.Play("dying"); ManagerResources.ReduceFood(managerUnits.index, -1); } if (information.HitPoints > 0) { Combat(); } }
public bool execute() { if (!go && ManagerResources.CompareGold(managerUnits.index, informationUnit.CostGold) && ManagerResources.CompareFood(managerUnits.index, informationUnit.CostFood)) { ManagerResources.ReduceGold(managerUnits.index, informationUnit.CostGold); ManagerResources.ReduceFood(managerUnits.index, informationUnit.CostFood); go = true; completed = false; remove = false; return(true); } return(false); }
public bool execute() { if (ManagerResources.CompareGold(managerUnits.index, building.information.CostGold)) // && ManagerResources.CompareFood(managerUnits.index, building.information.CostWood)) { ManagerResources.ReduceGold(managerUnits.index, building.information.CostGold); if ((building.information as InformationBuilding).Type == Util.Buildings.CHICKEN_FARM || (building.information as InformationBuilding).Type == Util.Buildings.PIG_FARM) { ManagerResources.ReduceFood(managerUnits.index, -5); } builder.workState = WorkigState.WAITING_PLACE; building.builder(); return(true); } return(false); }