Ejemplo n.º 1
0
    public void addRandomAction(GameObject gameObj)
    {
        Vector3 force = new Vector3(
            UnityEngine.Random.Range(-10, 10),
            UnityEngine.Random.Range(-10, 10),
            UnityEngine.Random.Range(-10, 10)
            );

        int[] X = { -20, 20 };
        int[] Y = { -5, 5 };
        int[] Z = { -20, -20 };

        Vector3 starttPos = new Vector3(
            UnityEngine.Random.Range(-70, 70),
            UnityEngine.Random.Range(-10, 10),
            UnityEngine.Random.Range(100, 150)
            );

        gameObj.transform.position = starttPos;

        Vector3 randomTarget = new Vector3(
            X[UnityEngine.Random.Range(0, 2)],
            Y[UnityEngine.Random.Range(0, 2)],
            Z[UnityEngine.Random.Range(0, 2)]
            );

        gameObj.GetComponent <Rigidbody> ().velocity = Vector3.zero;
        gameObj.GetComponent <Rigidbody> ().AddForce(force, ForceMode.Impulse);
        MoveToAction action = MoveToAction.getAction(randomTarget, gameObj.GetComponent <UFOData>().speed);

        RunAction(gameObj, action, this);
    }
Ejemplo n.º 2
0
        // ApplyMoveToAction
        public U3dAction ApplyMoveToAction(GameObject obj, Vector3 target, float speed, IU3dActionCompleted completed)
        {
            MoveToAction ac = obj.AddComponent <MoveToAction>();

            ac.setting(target, speed, completed);
            return(ac);
        }
Ejemplo n.º 3
0
    private void ExecuteAttack()
    {
        mTurnStatus = EnemyTurnStatus.Running;

        Node targetNode = mPath.First.Next.Value;
        // Do not move the enemy in the grid for attack.
        ScaleToAction scaleUp = new ScaleToAction(this.transform, Graph.SmoothStep, Vector3.one * DungeonManager.Instance.ScaleMultiplier * 1.75f, 0.5f);

        scaleUp.OnActionStart += () => { AudioManager.PlayPreAtkSound(); };

        MoveToAction moveToPos = new MoveToAction(this.transform, Graph.Dipper,
                                                  DungeonManager.Instance.GridPosToWorldPos(targetNode.PosX, targetNode.PosY), 0.25f);
        ScaleToAction  scaleDownHit = new ScaleToAction(this.transform, Graph.Dipper, Vector3.one * DungeonManager.Instance.ScaleMultiplier * 1.1f, 0.25f);
        ActionParallel hitParallel  = new ActionParallel(moveToPos, scaleDownHit);

        hitParallel.OnActionFinish += () => {
            GameManager.Instance.Player.TakeDamage(typeAlgorithms[(int)UnitType].GetDamagePower());
        };

        DelayAction returnDelay = new DelayAction(0.1f);

        MoveToAction moveBack = new MoveToAction(this.transform, Graph.SmoothStep,
                                                 DungeonManager.Instance.GridPosToWorldPos(PosX, PosY), 0.5f);
        ScaleToAction  scaleDownReturn = new ScaleToAction(this.transform, Graph.SmoothStep, Vector3.one * DungeonManager.Instance.ScaleMultiplier, 0.5f);
        ActionParallel returnParallel  = new ActionParallel(moveBack, scaleDownReturn);

        ActionSequence sequence = new ActionSequence(scaleUp, hitParallel, returnDelay, returnParallel);

        sequence.OnActionFinish = () => { mTurnStatus = EnemyTurnStatus.Processed; };
        ActionHandler.RunAction(sequence);
    }
Ejemplo n.º 4
0
    private void ExecuteMove(int _newX, int _newY)
    {
        AudioManager.PlayMoveSound();

        SetPosition(_newX, _newY);
        MoveToAction moveToPos = new MoveToAction(this.transform, Graph.InverseExponential,
                                                  DungeonManager.Instance.GridPosToWorldPos(_newX, _newY), 0.5f);

        moveToPos.OnActionFinish = () => {
            mTurnStatus = PlayerTurnStatus.Waiting; mSpriteRen.sortingOrder = mnDefaultSpriteOrderInLayer;

            // Check if reached the dungeonExit.
            if (DungeonManager.Instance.IsExitCell(PosX, PosY))
            {
                RepeatPanelControls.ClearRepeats();
                DeckManager.Instance.ReorganiseCards();
                GameManager.Instance.ReachedFloorExit();
            }

            // Repeat if needed.
            if (RepeatPanelControls.NumRepeatsLeft > 0)
            {
                if (RepeatPanelControls.NumRepeatsLeft > 0)
                {
                    ControlAreaManager.ExecutedCard.Execute();
                }
            }
        };
        ActionHandler.RunAction(moveToPos);
    }
    public void addRandomAction(GameObject gameObj)
    {
        int[] X = { -20, 20 };
        int[] Y = { -5, 5 };
        int[] Z = { -20, -20 };


        Vector3 starttPos = new Vector3(
            UnityEngine.Random.Range(-20, 20),
            UnityEngine.Random.Range(-20, 20),
            0
            );

        gameObj.transform.position = starttPos;

        /*Vector3 randomTarget = new Vector3(
         *      X[UnityEngine.Random.Range(0, 2)],
         *      Y[UnityEngine.Random.Range(0, 2)],
         *      Z[UnityEngine.Random.Range(0, 2)]
         * );*/

        MoveToAction action = MoveToAction.getAction(new Vector3(starttPos.x > 0? -20 :20, starttPos.y > 0? -20 :20, 0), gameObj.GetComponent <DiskData>().speed);

        RunAction(gameObj, action, this);
    }
Ejemplo n.º 6
0
    //船的平移
    public void moveBoat(GameObject boat)
    {
        Vector3 temp = boat.transform.position == sceneController.LeftBoatPos ? sceneController.RightBoatPos: sceneController.LeftBoatPos;

        action1 = MoveToAction.GetAction(temp, speed);
        this.RunAction(boat, action1, this);
    }
Ejemplo n.º 7
0
    //人上船
    public void getOnBoat(GameObject people, int shore, int seat)
    {
        if (shore == 0 && seat == 0)
        {
            action1 = MoveToAction.GetAction(new Vector3(-5f, people.transform.position.y, 0), speed);
            action2 = MoveToAction.GetAction(new Vector3(-5f, 0.5f, 0), speed);
        }
        else if (shore == 0 && seat == 1)
        {
            action1 = MoveToAction.GetAction(new Vector3(-3f, people.transform.position.y, 0), speed);
            action2 = MoveToAction.GetAction(new Vector3(-3f, 0.5f, 0), speed);
        }
        else if (shore == 1 && seat == 0)
        {
            action1 = MoveToAction.GetAction(new Vector3(3f, people.transform.position.y, 0), speed);
            action2 = MoveToAction.GetAction(new Vector3(3f, 0.5f, 0), speed);
        }
        else if (shore == 1 && seat == 1)
        {
            action1 = MoveToAction.GetAction(new Vector3(5f, people.transform.position.y, 0), speed);
            action2 = MoveToAction.GetAction(new Vector3(5f, 0.5f, 0), speed);
        }

        SequenceAction saction = SequenceAction.GetAction(0, 0, new List <SSAction> {
            action1, action2
        });

        this.RunAction(people, saction, this);
    }
Ejemplo n.º 8
0
    public void getOnBoat(GameObject people, int shore, int seat)
    {
        if (shore == 0 && seat == 0)
        {
            horizontal = MoveToAction.getAction(new Vector3(-5f, 2.7f, 0), speed); //右移
            vertical   = MoveToAction.getAction(new Vector3(-5f, 1.2f, 0), speed); //下移
        }
        else if (shore == 0 && seat == 1)
        {
            horizontal = MoveToAction.getAction(new Vector3(-3f, 2.7f, 0), speed); //右移
            vertical   = MoveToAction.getAction(new Vector3(-3f, 1.2f, 0), speed); //下移
        }
        else if (shore == 1 && seat == 0)
        {
            horizontal = MoveToAction.getAction(new Vector3(3f, 2.7f, 0), speed); //左移
            vertical   = MoveToAction.getAction(new Vector3(3f, 1.2f, 0), speed); //下移
        }
        else if (shore == 1 && seat == 1)
        {
            horizontal = MoveToAction.getAction(new Vector3(5f, 2.7f, 0), speed); //左移
            vertical   = MoveToAction.getAction(new Vector3(5f, 1.2f, 0), speed); //下移
        }

        SequenceAction saction = SequenceAction.getAction(0, 0, new List <SSAction> {
            horizontal, vertical
        });                                                                                                  //将动作组合

        this.Action(people, saction, this);
    }
Ejemplo n.º 9
0
        /// <summary>
        ///  <para>
        ///   Method used to command a creature to begin moving towards a specific location
        ///   at a specific speed.  The actual movement operation may take several turns,
        ///   but is always initiated using this method.  Your movement location should
        ///   be within the world boundary and your movement speed should be less than or
        ///   equal to your creature's Species.MaximumSpeed.
        ///  </para>
        ///  <para>
        ///   Once called the creature will begin moving towards the specified point.  This
        ///   movement will continue until you issue a different BeginMoving command to your
        ///   creature, it reaches its destination, or becomes blocked by something.  Any
        ///   calls to BeginMoving will clear out any previous calls, so care should be taken
        ///   when issuing multi-part path movements.
        ///  </para>
        ///  <para>
        ///   Once the movement is completed the MoveCompleted event will be fired and your
        ///   event handler for this function will be called if you've provided one.  The
        ///   event handler will provide full information about the results of an attempted
        ///   movement operation.
        ///  </para>
        /// </summary>
        /// <param name="vector">
        ///  The MovementVector that determines the point you are moving to and how fast to move there.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        ///  Thrown if the vector parameter is null.
        /// </exception>
        /// <exception cref="OutOfBoundsException">
        ///  Thrown if the destination is outside of the world boundaries.
        /// </exception>
        /// <exception cref="TooFastException">
        ///  Thrown if the speed defined in the vector is greater than Species.MaximumSpeed.
        /// </exception>
        public void BeginMoving(MovementVector vector)
        {
            if (vector == null)
            {
                throw new ArgumentNullException("vector", "The argument 'vector' cannot be null");
            }

            if (vector.Speed > State.AnimalSpecies.MaximumSpeed)
            {
                throw new TooFastException();
            }

            if (vector.Destination.X > World.WorldWidth - 1 ||
                vector.Destination.X < 0 ||
                vector.Destination.Y > World.WorldHeight - 1 ||
                vector.Destination.Y < 0)
            {
                throw new OutOfBoundsException();
            }

            var actionID = GetNextActionID();
            var action   = new MoveToAction(ID, actionID, vector);

            lock (PendingActions)
            {
                PendingActions.SetMoveToAction(action);
                InProgressActions.SetMoveToAction(action);
            }
        }
Ejemplo n.º 10
0
    /// <summary>
    /// Zoom the camera in towards a target
    /// </summary>
    /// <param name="_vec3TargetPosition"> The target position the camera will be zoom in towards </param>
    /// <param name="_bIsAnimate"> Determine if the pan snaps to target directly or have an Action sequence </param>
    public void ZoomInAt(Vector3 _vec3TargetPosition, bool _bIsAnimate)
    {
        if (m_bIsTransiting)
        {
            return;
        }

        // if: Animation is not specified
        if (!_bIsAnimate)
        {
            m_trCamera.position = transform.position - m_vec3CameraDirection * m_fZoomDistanceFromTarget;
            transform.position  = _vec3TargetPosition;
            m_bIsZoom           = true;
            return;
        }
        else
        {
            LocalMoveToAction actZoomInCamera = new LocalMoveToAction(m_trCamera, Graph.SmoothStep, -m_vec3CameraDirection * m_fZoomDistanceFromTarget, 0.25f);
            MoveToAction      actLookAtTarget = new MoveToAction(transform, Graph.SmoothStep, _vec3TargetPosition, 0.25f);
            actLookAtTarget.OnActionFinish += () =>
            {
                m_bIsTransiting = false;
                m_bIsZoom       = true;
            };

            ActionHandler.RunAction(actZoomInCamera, actLookAtTarget);
            m_bIsTransiting = true;
        }
    }
Ejemplo n.º 11
0
    public void addRandomAction(GameObject gameObj)
    {
        int[] X = { -20, 20 };
        int[] Y = { -5, 5 };
        int[] Z = { -20, -20 };

        // 随机生成起始点和终点
        Vector3 starttPos = new Vector3(
            UnityEngine.Random.Range(-70, 70),
            UnityEngine.Random.Range(-10, 10),
            UnityEngine.Random.Range(100, 150)
            );

        gameObj.transform.position = starttPos;

        Vector3 randomTarget = new Vector3(
            X[UnityEngine.Random.Range(0, 2)],
            Y[UnityEngine.Random.Range(0, 2)],
            Z[UnityEngine.Random.Range(0, 2)]
            );

        MoveToAction action = MoveToAction.getAction(randomTarget, gameObj.GetComponent <DiskData>().speed);

        RunAction(gameObj, action, this);
    }
Ejemplo n.º 12
0
    public AbstractAction(GameObject actor)
    {
        this.actor = actor;

        state = actor.GetComponent(typeof(CharacterState)) as CharacterState;
        animator = actor.GetComponent(typeof(CharacterAnimator)) as CharacterAnimator;
        mover = actor.GetComponent(typeof(CharacterMover)) as CharacterMover;
        actionRunner = actor.GetComponent(typeof(ActionRunner)) as ActionRunner;

        animationName = null;
        wrapMode = WrapMode.Once;
        emotionBodyParts = Emotion.BodyParts.NONE;

        canStartDialogueWithPC = true;
        canStartDialogueWithAgents = true;
        canEndAnyTime = true;
        //canCancelDuringMovement = true;

        quickReaction = null;
        moveToAction = null;

        started = false;
        endedASAP = false;
        endNextRound = false;

        finished = false;
    }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     scene_controller = (FirstController)Director.getInstance().currentSceneController;
     moveToLeft       = MoveToAction.GetAction(new Vector3(-1, 0, 0), 1);
     moveToRight      = MoveToAction.GetAction(new Vector3((float)1.5, 0, 0), 1);
     teleportTo       = TeleportAction.GetAction(new Vector3(0, 0, 0));
 }
Ejemplo n.º 14
0
    public SSAction ApplyMoveToAction(GameObject obj, Vector3 target, float speed, ActionCallback callback)
    {
        MoveToAction act = obj.AddComponent <MoveToAction>();

        act.setting(target, speed, callback);
        return(act);
    }
 protected new void Start()
 {
     sceneController = Director.getInstance().currentSceneController as FirstSceneController;
     sceneController.actionManager = this;
     moveToLeft  = MoveToAction.GetAction(new Vector3(-1, 0.2f, 0), speed);
     moveToRight = MoveToAction.GetAction(new Vector3(1, 0.2f, 0), speed);
 }
Ejemplo n.º 16
0
    public static MoveToAction GetAction(Vector3 destination, float speed)
    {
        MoveToAction action = ScriptableObject.CreateInstance <MoveToAction>();

        action.destination = destination;
        action.speed       = speed;
        return(action);
    }
Ejemplo n.º 17
0
    public static MoveToAction getAction(Vector3 target, float speed)
    {
        MoveToAction action = ScriptableObject.CreateInstance <MoveToAction>();

        action.target = target;
        action.speed  = speed;
        return(action);
    }
    public static Action getAction(GameObject gameobject, Vector3 dist, float during)
    {
        MoveToAction ac = ScriptableObject.CreateInstance <MoveToAction>();

        ac.to         = dist;
        ac._during    = during;
        ac.gameobject = gameobject;
        return(ac);
    }
Ejemplo n.º 19
0
    public void FocusCameraToPos(Vector3 _focalPos, float _focusDuration, Graph _focusGraph)
    {
        _focalPos.y -= mfCenterYOffset;
        _focalPos    = ConstrainVectorToCameraBounds(_focalPos);
        MoveToAction focusToPos    = new MoveToAction(camTransform, _focusGraph, _focalPos, _focusDuration);
        TickAction   updateMiniMap = new TickAction(_focusDuration, UpdateMiniMap);

        ActionHandler.RunAction(focusToPos, updateMiniMap);
    }
Ejemplo n.º 20
0
        ///<summary>
        ///</summary>
        ///<param name="moveToAction"></param>
        ///<exception cref="ApplicationException"></exception>
        public void SetMoveToAction(MoveToAction moveToAction)
        {
            if (IsImmutable)
            {
                throw new ApplicationException("PendingActions must be mutable to modify actions.");
            }

            MoveToAction = moveToAction;
        }
Ejemplo n.º 21
0
    private void DoMove(MseSceneObjMove sceneObj)
    {
        var targetPos = new Vector3(sceneObj.posX / sceneNode.SCALE, sceneObj.posY / sceneNode.SCALE, 0);
        var lastTime  = GlobalServerTime.getLastTime(sceneObj.endTime);

        UnityEngine.Debug.Log("lastTime = " + lastTime + "," + sceneObj.posX + "," + sceneObj.posY);
        var tempAction = new MoveToAction(targetPos, lastTime / 1000);

        ActionManager.GetInstance().RunAction(sceneNode, tempAction, null);
        currentActions[(int)E_SceneObjMoveS.MOVE] = tempAction;
    }
Ejemplo n.º 22
0
 public virtual void OnSceneView(SceneView sceneView)
 {
     if (CurrentMoveToAction != null && Visible)
     {
         Node.transform.position = Vector3.SmoothDamp(Node.transform.position, CurrentMoveToAction.TargetPosition, ref CurrentMoveToAction.CurrentVelocity, CurrentMoveToAction.ApproxTime);
         if (Vector3.Distance(Node.transform.position, CurrentMoveToAction.TargetPosition) < 1.0E-3f)
         {
             CurrentMoveToAction = null;
         }
     }
 }
Ejemplo n.º 23
0
        /// <summary>
        ///  Called by the game engine in order to kill the current creature.
        ///  Since this method can only be called when the state is mutable
        ///  player's can't use the method to arbitrarily kill competing
        ///  organisms.
        /// </summary>
        /// <internal/>
        public void Kill(PopulationChangeReason reason)
        {
            if (IsImmutable)
            {
                throw new GameEngineException("Object is immutable.");
            }

            _currentMoveToAction = null;
            _energy     = 0;
            DeathReason = reason;
        }
Ejemplo n.º 24
0
    public void Shake()
    {
        Vector3      vec3Shake = new Vector3(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value).normalized;
        MoveToAction actShake  = new MoveToAction(transform, Graph.InverseQuadratic, transform.position + vec3Shake, 0.1f);

        actShake.OnActionFinish += () =>
        {
            m_bIsTransiting = false;
        };
        ActionHandler.RunAction(actShake);
        m_bIsTransiting = true;
    }
Ejemplo n.º 25
0
        public void CreateMoveToAction()
        {
            int          boardSpaceID = 30;
            bool         clockwise    = true;
            MoveToAction moveAction   = new MoveToAction(boardSpaceID, clockwise);

            // correct board space ID stored
            Assert.AreEqual(boardSpaceID, moveAction.GetBoardSpaceID());
            // correct direction stored
            Assert.IsTrue(moveAction.MoveClockwise());
            // implements IAction interface
            Assert.IsTrue(moveAction is IAction);
        }
Ejemplo n.º 26
0
    public Action MoveAround(GameObject prop, int sign)
    {
        Vector3 position = new Vector3((sign - 1) / 3 * 10 - 10, 0, (sign - 1) % 3 * 10 - 10);
        Action  action1  = MoveToAction.GetAction(new Vector3(position.x - 2f, 0, position.z - 2f), speed);
        Action  action2  = MoveToAction.GetAction(new Vector3(position.x - 2f, 0, position.z + 2f), speed);
        Action  action3  = MoveToAction.GetAction(new Vector3(position.x + 2f, 0, position.z + 2f), speed);
        Action  action4  = MoveToAction.GetAction(new Vector3(position.x + 2f, 0, position.z - 2f), speed);
        Action  sequence = SequenceAction.GetAction(-1, 0, speed, new List <Action> {
            action1, action2, action3, action4
        });

        AddAction(prop, sequence, this);
        return(sequence);
    }
Ejemplo n.º 27
0
    private void ShiftCard(int _fromSlotID, int _toSlotID)
    {
        mCards[_toSlotID].CopyCardData(mCards[_fromSlotID]);
        mCards[_fromSlotID].ToggleCard(false);
        mCards[_toSlotID].ToggleCard(true);
        mCards[_toSlotID].SetCardDraggable(false);

        // Animate toCard move from fromCard to toCard.
        mCardTransforms[_toSlotID].position = mCards[_fromSlotID].OriginPos;
        MoveToAction moveCard = new MoveToAction(mCardTransforms[_toSlotID], Graph.InverseExponential, mCards[_toSlotID].OriginPos, 0.6f);

        moveCard.OnActionFinish += () => {
            mCards[_toSlotID].SetCardDraggable(true);
        };
        ActionHandler.RunAction(moveCard);
    }
Ejemplo n.º 28
0
    private void ExecuteMove()
    {
        AudioManager.PlayMoveSound();

        Node targetNode = mPath.First.Next.Value;

        MovePosition(targetNode.PosX, targetNode.PosY);
        MoveToAction moveToPos = new MoveToAction(this.transform, Graph.InverseExponential,
                                                  DungeonManager.Instance.GridPosToWorldPos(targetNode.PosX, targetNode.PosY), 0.5f);

        moveToPos.OnActionFinish = () => { mTurnStatus = EnemyTurnStatus.Processed; };
        ActionHandler.RunAction(moveToPos);

        BoardScroller.Instance.FocusCameraToPos(
            DungeonManager.Instance.GridPosToWorldPos(PosX, PosY),
            0.2f,
            Graph.InverseExponential);
    }
Ejemplo n.º 29
0
    public void getOffBoat(GameObject people, int shoreNum)
    {
        horizontal = MoveToAction.getAction(new Vector3(people.transform.position.x, 2.7f, 0), speed);//上移

        if (shoreNum == 0)
        {
            vertical = MoveToAction.getAction(new Vector3(-16f + 1.5f * Convert.ToInt32(people.name), 2.7f, 0), speed);               //左移
        }
        else
        {
            vertical = MoveToAction.getAction(new Vector3(16f - 1.5f * Convert.ToInt32(people.name), 2.7f, 0), speed); //右移
        }
        SequenceAction saction = SequenceAction.getAction(0, 0, new List <SSAction> {
            horizontal, vertical
        });                                                                                                  //将动作组合

        this.Action(people, saction, this);
    }
Ejemplo n.º 30
0
    //人下船
    public void getOffBoat(GameObject people, int shoreNum)
    {
        action1 = MoveToAction.GetAction(new Vector3(people.transform.position.x, 2.5f, 0), speed);//人向上移动

        if (shoreNum == 0)
        {
            action2 = MoveToAction.GetAction(new Vector3(-6f - sceneController.distanceBetweenObj * Convert.ToInt32(people.name), 2.5f, 0), speed);               //人向左移动
        }
        else
        {
            action2 = MoveToAction.GetAction(new Vector3(6f + sceneController.distanceBetweenObj * Convert.ToInt32(people.name), 2.5f, 0), speed); //人向右移动
        }
        SequenceAction saction = SequenceAction.GetAction(0, 0, new List <SSAction> {
            action1, action2
        });

        this.RunAction(people, saction, this);
    }
Ejemplo n.º 31
0
    public void ReturnExecutedCard()
    {
        ControlAreaManager.ExecutedCard.ToggleCard(true);
        ControlAreaManager.ExecutedCard.SetCardDraggable(false);
        ControlAreaManager.ExecutedCard.transform.SetAsLastSibling();

        // Animate toCard move from fromCard to toCard.
        ControlAreaManager.ExecutedCard.transform.position = svec3UseCardPos;
        MoveToAction moveCard = new MoveToAction(
            ControlAreaManager.ExecutedCard.transform,
            Graph.InverseExponential,
            ControlAreaManager.ExecutedCard.OriginPos,
            0.4f);

        moveCard.OnActionFinish += () => {
            ControlAreaManager.ExecutedCard.SetCardDraggable(true);
            ControlAreaManager.ExecutedCard.transform.SetSiblingIndex(ControlAreaManager.ExecutedCard.OriginSiblingIndex);
        };
        ActionHandler.RunAction(moveCard);
    }
Ejemplo n.º 32
0
 public virtual void UpdateAction()
 {
     //Debug.Log("UpdateAction: " + this + ": " + actor.name);
     if (quickReaction != null){
         //Debug.Log("Updating quickReaction");
         quickReaction.UpdateAction();
         if (quickReaction.IsFinished()){
             quickReaction = null;
         }
     } else if (moveToAction != null){
         //Debug.Log("Updating moveToAction");
         moveToAction.UpdateAction();
         if (moveToAction.IsFinished()){
             //Debug.Log("moveToAction is finished.");
             moveToAction = null;
         }
     } else {
         //Debug.Log("Regular update.");
         if (!started){
             //Debug.Log("started == false");
             if (endNextRound){
                 //Debug.Log("Ending before starting.");
                 finished = true;
                 EndedBeforeStarting();
                 return;
             }
             if (animationName != null){
                 if (!IsCompleted()){
                     StartAnimation(animationName, wrapMode, emotionBodyParts);
                 }
             }
             ActionDebug.LogActionStarted(actor, this);
             UpdateFirstRound();
             started = true;
         }
         //Debug.Log("Any Round: " + this + ": " + actor.name);
         UpdateAnyRound();
         if (IsLastRound()){
             //Debug.Log("Last Round: " + this + ": " + actor.name);
             ActionDebug.LogActionEnded(actor, this);
             UpdateLastRound(endedASAP);
             finished = true;
         }
     }
 }
Ejemplo n.º 33
0
 protected void InitMovementInfo(GameObject target, float maximumDistanceFromTarget, float minimumDistanceFromTarget, bool sitDown, bool turnToFaceTarget, bool turnToMatchWaypoint)
 {
     if (target == null){
         Debug.LogError("AbstractAction.InitMovementInfoYou(): " + actor.name + ". No target provided!");
         return;
     }
     moveToAction = new MoveToAction(actor, target, maximumDistanceFromTarget, minimumDistanceFromTarget, sitDown, turnToFaceTarget, turnToMatchWaypoint, false);
     //this.canCancelDuringMovement = canCancelDuringMovement;
 }