コード例 #1
0
    public void SetNPC(NPC _curNPC)
    {
        m_curNPC = _curNPC;

        m_nextNPC       = NPCName.None;
        m_nextNPCAction = NPCActionName.None;
    }
コード例 #2
0
    public NPCName m_parentNPCName;     // 나중에 NPC 이름 확인가능 할 때 따로 초기화 해준다.


    public NPCAction()
    {
        m_choiceList    = new List <NPCActionChoice>();
        m_id            = -1;
        m_npcActionName = NPCActionName.None;
        m_desc          = "none";
        m_parentNPCName = NPCName.None;
    }
コード例 #3
0
        public Entity GetEntityWithName(NPCName name)
        {
            if (!namedEntities.ContainsKey(name.ToString()))
            {
                return(null);
            }

            return(namedEntities[name.ToString()]);
        }
コード例 #4
0
        public NpcTemplate(NPCName name, SpeciesType species, JobType job, FaceType face, HairType hair, ClothingTopType top, ClothingBottomType bottom) : this()
        {
            Name    = name;
            Species = species;
            Job     = job;

            Top    = top;
            Bottom = bottom;
            Hair   = hair;
            Face   = face;
        }
コード例 #5
0
    public void Init(FlowManager _mgr)
    {
        m_mgr = _mgr;

        m_curNPC        = null;
        m_curAction     = null;
        m_curChoiceList = null;
        m_curState      = FlowState.GetNPC;

        m_choiceID = -1;

        m_nextNPC       = NPCName.Player;
        m_nextNPCAction = NPCActionName.PlayerIntro1;
    }
コード例 #6
0
        private void nPCNamebmdToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string fpath = OpenDialog();

            if (string.IsNullOrEmpty(fpath))
            {
                return;
            }


            NPCName      Decoder = new NPCName(fpath, BmdFile.FileType.NPCName);
            ClientEditor editor  = new ClientEditor(Decoder, false);

            editor.Show();
        }
コード例 #7
0
ファイル: NPC.cs プロジェクト: Valteria/GGJTeam2Git
 //IInteractableObject
 public void SetupInteractable()
 {
     /* Set default interaction text if none is present
      */
     if (m_InteractionText == null || m_InteractionText.Trim().Equals(""))
     {
         if (NPCName.Trim().Equals(""))
         {
             m_InteractionText = "Press E to Talk";
         }
         else
         {
             m_InteractionText = "Press E to Talk to " + NPCName;
         }
     }
 }
コード例 #8
0
    public NPC GetNPC(NPCName _name = NPCName.None)
    {
        if (_name != NPCName.None)
        {
            return(m_model.GetNPC(_name));
        }

        // 여기서 이제 여러 상황에 따라서 npc를 골라서 넘겨줘야 한다.
        // 테스트를 위해서 랜덤하게 그냥 넘긴다.

        Debug.Log("적당한 친구들이 필요하다. 여기서 조건에 따라서 골라올 수 있게 하기");

        int random = UnityEngine.Random.Range(1, System.Enum.GetNames(typeof(NPCName)).Length);

        NPCName name = (NPCName)random;

        return(m_model.GetNPC(name));
    }
コード例 #9
0
        /// <summary>
        /// Creates a new npc and adds it to the game. (No other components created)
        /// </summary>
        /// <param name="name">The type of npc to create.</param>
        public uint CreateNPC(NPCName name, Position position)
        {
            uint eid = Entity.NextEntity();
            NPC npc;
            Sprite sprite;
            Collideable collideable;
            Texture2D spriteSheet;
            Movement movement;
            SpriteAnimation spriteAnimation;
            NpcAI ai;

            switch (name)
            {
                case NPCName.Trollph:
                     sprite = new Sprite()
                        {
                            EntityID = eid,
                            SpriteSheet = _game.Content.Load<Texture2D>("Spritesheets/NPC/trollph"),
                            SpriteBounds = new Rectangle(0, 0, 64, 64),
                        };

                        ai = new NpcAI()
                        {
                            EntityID = eid,
                            Type = NPCType.Background,
                        };
                        _game.NpcAIComponent.Add(eid, ai);

                        break;
                case NPCName.DarkRalph:

                        sprite = new Sprite()
                        {
                            EntityID = eid,
                            SpriteSheet = _game.Content.Load<Texture2D>("Spritesheets/NPC/darkralph"),
                            SpriteBounds = new Rectangle(0, 0, 64, 64),
                        };

                         ai = new NpcAI()
                         {
                            EntityID = eid,
                            Type = NPCType.Background,
                         };
                        _game.NpcAIComponent.Add(eid, ai);

                        break;

                    default:
                        throw new Exception("Unknown NPC");
                }

                npc.EntityID = eid;
                npc.Type = name;
                position.EntityID = eid;

                spriteAnimation = new SpriteAnimation()
                {
                    EntityID = eid,
                    FramesPerSecond = 10,
                    IsLooping = true,
                    IsPlaying = false,
                    TimePassed = 0f,
                    CurrentFrame = 0,
                    CurrentAnimationRow = 0

                };
                _game.SpriteAnimationComponent[eid] = spriteAnimation;

                movement = new Movement()
                {
                    EntityID = eid,
                };

                _game.MovementComponent[eid] = movement;

                collideable = new Collideable()
                {
                    EntityID = eid,
                    RoomID = position.RoomID,
                    Bounds = new CircleBounds(position.Center, position.Radius)
                };
                _game.CollisionComponent[eid] = collideable;

                _game.NPCComponent.Add(eid, npc);
                _game.PositionComponent.Add(eid, position);
                _game.SpriteComponent.Add(eid, sprite);
                return eid;
        }
コード例 #10
0
        /// <summary>
        /// Creates a new npc and adds it to the game. (No other components created)
        /// </summary>
        /// <param name="name">The type of npc to create.</param>
        public uint CreateNPC(NPCName name, Position position)
        {
            uint            eid = Entity.NextEntity();
            NPC             npc;
            Sprite          sprite;
            Collideable     collideable;
            Texture2D       spriteSheet;
            Movement        movement;
            SpriteAnimation spriteAnimation;
            NpcAI           ai;

            switch (name)
            {
            case NPCName.Trollph:
                sprite = new Sprite()
                {
                    EntityID     = eid,
                    SpriteSheet  = _game.Content.Load <Texture2D>("Spritesheets/trollph"),
                    SpriteBounds = new Rectangle(0, 0, 64, 64),
                };

                ai = new NpcAI()
                {
                    EntityID = eid,
                    Type     = NPCType.Background,
                };
                _game.NpcAIComponent.Add(eid, ai);

                break;

            case NPCName.DarkRalph:

                sprite = new Sprite()
                {
                    EntityID     = eid,
                    SpriteSheet  = _game.Content.Load <Texture2D>("Spritesheets/darkralph"),
                    SpriteBounds = new Rectangle(0, 0, 64, 64),
                };


                ai = new NpcAI()
                {
                    EntityID = eid,
                    Type     = NPCType.Background,
                };
                _game.NpcAIComponent.Add(eid, ai);

                break;

            default:
                throw new Exception("Unknown NPC");
            }

            npc.EntityID      = eid;
            npc.Type          = name;
            position.EntityID = eid;

            spriteAnimation = new SpriteAnimation()
            {
                EntityID            = eid,
                FramesPerSecond     = 10,
                IsLooping           = true,
                IsPlaying           = false,
                TimePassed          = 0f,
                CurrentFrame        = 0,
                CurrentAnimationRow = 0
            };
            _game.SpriteAnimationComponent[eid] = spriteAnimation;

            movement = new Movement()
            {
                EntityID = eid,
            };

            _game.MovementComponent[eid] = movement;

            collideable = new Collideable()
            {
                EntityID = eid,
                Bounds   = new CircleBounds(position.Center, position.Radius)
            };
            _game.CollisionComponent[eid] = collideable;

            _game.NPCComponent.Add(eid, npc);
            _game.PositionComponent.Add(eid, position);
            _game.SpriteComponent.Add(eid, sprite);
            return(eid);
        }
コード例 #11
0
 public NPC GetNPC(NPCName _name)
 {
     return(m_npcList[(int)_name]);
 }
コード例 #12
0
ファイル: EntityQueries.cs プロジェクト: callumlawson/Sellout
 public static Entity GetEntityWithName(List <Entity> entities, NPCName name)
 {
     return(entities.Find(entity => entity.HasState <NameState>() && entity.GetState <NameState>().Name == name.ToString()));
 }
コード例 #13
0
 public NPC()
 {
     m_desc       = "none";
     m_npcName    = NPCName.None;
     m_actionList = new List <NPCAction>();
 }
コード例 #14
0
 public NPCNameSt(Dictionary <string, string> _data)
 {
     m_id      = int.Parse(_data["ID"]);
     m_givenID = int.Parse(_data["GivenID"]);
     m_npcName = (NPCName)m_givenID;
 }