示例#1
0
        public static TraceAction GetAction(GameObject gameObject, IActionCallback callback, GameObject target, float speed)
        {
            TraceAction action = CreateInstance <TraceAction>();

            action.gameObject = gameObject;
            action.transform  = gameObject.transform;
            action.callback   = callback;
            action.target     = target;
            action.speed      = speed;
            return(action);
        }
示例#2
0
        // 巡逻兵追随玩家。
        public void Trace(GameObject patrol, GameObject player)
        {
            var area = patrol.GetComponent <Soldier>().area;

            // 防止重入。
            if (area == currentArea)
            {
                return;
            }
            currentArea = area;
            if (moveToActions.ContainsKey(area))
            {
                moveToActions[area].destroy = true;
            }
            TraceAction action = TraceAction.GetAction(patrol, this, player, 1.5f);

            AddAction(action);
        }