Beispiel #1
0
        public static void initialize(EngineStateGameplay esg, PlayerController pc, CompanionController cc, Area startArea)
        {
            GameplayState = esg;
            playerController = pc;
            companionController = cc;
            activeArea = startArea;

            activeArea.add(cc);
            activeArea.add(pc);
        }
Beispiel #2
0
        /// <summary>
        /// Factory method to create CharacterControllers
        /// </summary>
        /// <param name="ci">Information about character apperance and stats</param>
        /// <param name="startpos">Where in the Area the character should be placed</param>
        /// <param name="playerControlled">True if the character should be a PC, false if NPC</param>
        /// <returns>Constructed CharacterController</returns>
        public static CharacterController construct(CharacterInfo ci, Vector2 startpos, Constants.CharType typeOfChar, PlayerController p)
        {
            CharacterController cc;
            cc = new CharacterController();
            cc.m_doodadIndex = 0;
            ColliderType type;
            if (typeOfChar == Constants.CharType.PLAYERCHAR)
            {
                cc = new PlayerController();
                type = ColliderType.PC;

                cc.m_doodadIndex = Constants.PLAYER;
                cc.bouncer = null;
                cc.brew = new Brew(0, 0);

                currPlan = null;// new ActionNode(ActionNode.EMPTY);
            }
            else if (typeOfChar == Constants.CharType.NPCHAR)
            {
                type = ColliderType.NPC;

                cc.bouncer = null;

                cc.brew = null;
            }
            else
            {
                cc = new CompanionController(p);
                type = ColliderType.PC;
                cc.m_doodadIndex = Constants.COMPANION;

                cc.bouncer = null;
                cc.brew = new Brew(0, 0);
            }

            cc.m_position = startpos;

            cc.AnimationController = new AnimationController(ci.animationDataPath, ci.animationTexturePath);
            cc.AnimationController.ActionTriggered += new ActionTriggeredEventHandler(cc.handleAction);
            cc.AnimationController.Scale = ci.scale;

            Rectangle bounds = ci.collisionBox;
            bounds.Offset((int)cc.m_position.X, (int)cc.m_position.Y);
            cc.m_collider = new Collider(cc, bounds, type);

            cc.m_speed =  ci.speed;

            //if(PCControllerInput.

            cc.m_previousAngle = (float)Math.PI / 2;

            cc.victim = -1;
            cc.social_game = null;

            cc.walking = false;
            cc.walk_target = -1;
            cc.walk_dir = -1;
            cc.distance = 0;

            return cc;
        }