public override void StartAction() { Cat cat = GetCat(); FurnitureBase foodBow = catCafe.GetFurnitureByType(FurnitureType.Food); InteractPoint point = foodBow.ReserveInteractionPoint(cat); if (point == null) { // TODO need to check, there is bug when two cat both reserve ActionEnd(); return; } // TODO if no point CatWalkTask walkTask = actionHolder.AddComponent <CatWalkTask>(); walkTask.SetTaskTarget(foodBow.gameObject, point.transform.position, cat); CatEatTask eatTask = actionHolder.AddComponent <CatEatTask>(); eatTask.SetTaskTarget(foodBow.gameObject, Vector3.zero, cat); TaskChain chain = actionHolder.AddComponent <TaskChain>(); chain.PushTask(walkTask); chain.PushTask(eatTask); chain.notifyTaskChainEnd += OnTaskChainEnd; chain.StartTaskChain(); }
public override void StartAction() { Cat cat = GetCat(); FurnitureBase drinkBow = catCafe.GetFurnitureByType(FurnitureType.Water); InteractPoint point = drinkBow.ReserveInteractionPoint(cat); if (point == null) { ActionEnd(); return; } CatWalkTask walkTask = actionHolder.AddComponent <CatWalkTask>(); walkTask.SetTaskTarget(drinkBow.gameObject, point.transform.position, cat); CatDrinkTask drinkTask = actionHolder.AddComponent <CatDrinkTask>(); drinkTask.SetTaskTarget(drinkBow.gameObject, Vector3.zero, cat); TaskChain chain = actionHolder.AddComponent <TaskChain>(); chain.PushTask(walkTask); chain.PushTask(drinkTask); chain.notifyTaskChainEnd += OnTaskChainEnd; chain.StartTaskChain(); }