示例#1
0
 /// <summary>
 /// Increments Current Amount of Required Kills
 /// </summary>
 private void IncrementCurrentAmount(NpcCharacter npcCharacter)
 {
     if (npcCharacter.GetNpcData() == npc)
     {
         CurrentAmount++;
     }
 }
        private void SpawnNpc(NpcCharacter npcCharacter)
        {
            if (entities.FirstOrDefault(x => x.StartPosition.X == npcCharacter.NpcTemplate.StartPosition.X &&
                                        x.StartPosition.Y == npcCharacter.NpcTemplate.StartPosition.Y &&
                                        x.StartPosition.Z == npcCharacter.NpcTemplate.StartPosition.Z) != null)
            {
                return;
            }

            Vector3 npcPosition = new Vector3(npcCharacter.NpcTemplate.Position.X, npcCharacter.NpcTemplate.Position.Y,
                                              npcCharacter.NpcTemplate.Position.Z);
            Vector3 npcRotation = new Vector3(npcCharacter.NpcTemplate.Rotation.X, npcCharacter.NpcTemplate.Rotation.Y,
                                              npcCharacter.NpcTemplate.Rotation.Z);

            npcPosition.y = Terrain.activeTerrain.SampleHeight(npcPosition);
            Debug.Log(npcPosition);
            var characterPrefab = Resources.Load(npcCharacter.NpcTemplate.Prefab) as GameObject;


            var obj = Instantiate(characterPrefab, npcPosition, Quaternion.Euler(npcRotation));

            obj.name = npcCharacter.NpcTemplate.Identifier.ToString();
            if (obj != null)
            {
                var entity = obj.AddComponent <Entity>();

                entity.Position      = npcPosition;
                entity.StartPosition = npcCharacter.NpcTemplate.StartPosition;
                entity.EntityName    = npcCharacter.NpcTemplate.Name;
                entity.Identifier    = npcCharacter.NpcTemplate.Identifier;

                pubSubActorsEntities.Add(new EntityChannel(npcCharacter.NpcTemplate.Identifier.ToString()));
                entities.Add(entity);
            }
        }
示例#3
0
 public NpcAttackState(NpcCharacter npc
                       , INpcAnimatorController animatorController
                       , INpcStateController npcStateController)
     : base(npc, animatorController, npcStateController)
 {
     StateName = "Attack";
     ChooseAttackType();
 }
示例#4
0
 /// <summary>
 /// Constructor that initializes all EscortObjective variables
 /// </summary>
 /// <param name="npc">Reference to the <see cref="NpcCharacterData"/> of the NPC that should be escorted</param>
 /// <param name="description">Description of the Objective</param>
 /// <param name="failed">Checker if the Objective is Failed</param>
 /// <param name="completed">Checker if the Objective is Completed</param>
 /// <param name="npcRb">Reference to the <see cref="Collision"/> object of the NPC</param>
 /// <param name="escortPointCollision">Location where NPC should be escorted to</param>
 /// <param name="hasTimer">Defines if the Objective has a time limit</param>
 /// <param name="timer">Time that is given to complete the Objective</param>
 public EscortObjective(NpcCharacter npc, string description, bool failed, bool completed, Collision npcRb, Collision escortPointCollision, bool hasTimer = false, float timer = 1f)
 {
     this.npc    = npc;
     Failed      = failed;
     HasTimer    = hasTimer;
     Timer       = timer;
     Description = description;
     Completed   = completed;
     this.npcRb  = npcRb;
     this.escortPointCollision = escortPointCollision;
 }