示例#1
0
    public override void StartAction()
    {
        if (toyTask == null)
        {
            SelectNearestToy();
            // TODO more toys
            toyTask = ActionUtils.Instance.CreatCatTaskByType(TaskType.PlayBall, toyObj, Vector3.zero, GetCat());
        }

        if (toyObj == null)
        {
            Debug.LogError("Cannot find any Toy");
            return;
        }
        CatRunTask runTask = ActionUtils.Instance.CreatCatTaskByType(TaskType.Run, toyObj, toyObj.transform.position, GetCat()) as CatRunTask;

        runTask.StopDistance = 0.5f;

        CatPlayBallTask playBallTask = actionHolder.AddComponent <CatPlayBallTask>();

        playBallTask.SetTaskTarget(toyObj, Vector3.zero, GetCat());

        TaskChain chain = actionHolder.AddComponent <TaskChain>();

        chain.PushTask(runTask);
        chain.PushTask(playBallTask);
        chain.notifyTaskChainEnd += OnTaskChainEnd;

        chain.StartTaskChain();
    }
示例#2
0
    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();
    }
示例#3
0
    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();
    }