예제 #1
0
 /// <summary>
 /// Does damage to a unit
 /// </summary>
 /// <param name="npc"></param>
 /// <param name="amount"></param>
 /// <param name="pushbackFrom"></param>
 /// <returns>Returns true if damage was done</returns>
 public bool Damage(ActiveNpc npc, int amount, Vector2 pushbackFrom)
 {
     if (npc.Invunerable > 0) { return false; }
     npc.Health -= amount;
     npc.Invunerable = 30;
     npc.Movement.PushbackFrom(pushbackFrom, 8f);
     if (npc.Health <= 0){ActiveNpcs.Remove(npc);}
     return true;
 }
예제 #2
0
 /// <summary>
 /// Called at the start of a conversation between the player and an npc
 /// </summary>
 /// <param name="subject">The subject npc of the interaction</param>
 public void Start(ActiveNpc subject)
 {
     Subject = subject;
     State = NpcInteractionState.Intro;
     CurrentText = subject.Type.Dialog.Get(State).Line;
     SkipFrame = true;
 }
예제 #3
0
 /// <summary>
 /// End the conversation
 /// </summary>
 public void End()
 {
     Subject = null;
     State = NpcInteractionState.None;
 }
예제 #4
0
        public void Initialize(ContentManager content, Package package, Texture2D uiTexture)
        {
            UiTexture = uiTexture;

            // Ai
            Ai[0] = new NpcAiDummy();
            Ai[1] = new NpcAiChase();

            // Races
            Races[0] = new NpcRace("Lynch", content.Load<Texture2D>("Npcs/Sprites/lynch"), package.LocalString("c:/blueprint/lynch.xml", false));

            // Npcs
            Types[0] = new NpcType("The Lynch", Races[0], Ai[1]);
            Types[0].Dialog.Add("Hello {playername}", NpcInteraction.NpcInteractionState.Intro);
            Types[0].Dialog.Add("Here is some interesting information {playername}", NpcInteraction.NpcInteractionState.Gossip);

            // Active Npcs
            ActiveNpc npc = new ActiveNpc(Types[0], new Vector2(200, -50));
            ActiveNpcs.Add(npc);
        }