Example #1
0
        public bool Event_NewTurn(ComponentEvent e)
        {
            if (isDead)
            {
                return(true);
            }

            // Use the thinker engine to get an action for this turn
            ThinkAction turnActions = ThinkerEngine.ProcessThinker(owner, thinkerState);


            // Just wander in a random direction
            //TCODRandom rng = TCODRandom.getInstance();
            //int randDirection = rng.getInt(0, 10);
            //Vector2 moveDirection = new Vector2(0, 0);
            //
            //switch(randDirection) {
            //    case 0:
            //        moveDirection = new Vector2(1, 0);
            //        break;
            //    case 1:
            //        moveDirection = new Vector2(-1, 0);
            //        break;
            //    case 2:
            //        moveDirection = new Vector2(0, 1);
            //        break;
            //    case 3:
            //        moveDirection = new Vector2(0, -1);
            //        break;
            //}

            if (turnActions.moveStep.X != 0 || turnActions.moveStep.Y != 0)
            {
                owner.FireEvent(new EMove()
                {
                    direction = turnActions.moveStep
                });
            }

            return(true);
        }
        public override void BeforeActUpdate(ThinkAction thinkAction, Delta delta)
        {
            base.BeforeActUpdate(thinkAction, delta);

            if (!thinkActionActivationDecided)
            {
                if (Game1.Random.Next(100) <= chanceOfEffect)
                {
                    thinkAction.Active = false;
                }
                thinkActionActivationDecided = true;
            }
            else if (thinkAction.Active)
            {
                finished = true;
            }
            else
            {
                updateShockEffect(thinkAction.Actor, delta);
            }

            checkFinish(thinkAction.Actor);
        }
 public override void BeforeActStart(ThinkAction thinkAction)
 {
     base.BeforeActStart(thinkAction);
     start(thinkAction.Actor);
 }
Example #4
0
 public virtual void BeforeActUpdate(ThinkAction thinkAction, Delta delta)
 {
 }
Example #5
0
 public virtual void BeforeActStart(ThinkAction thinkAction)
 {
 }