Exemplo n.º 1
0
        /// <summary>
        /// Instantiate all targets in the game world using their respective prefabs.
        /// </summary>
        protected void Spawn()
        {
            foreach (var target in Targets)
            {
                Transform prefab;
                switch (TargetType)
                {
                case TargetType.Paper:
                    throw new NotImplementedException();

                case TargetType.Dummy:
                    prefab = DummyTargetPrefab;
                    break;

                case TargetType.Person:
                    prefab = GetRandomNpc();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                target.Spawn(prefab);

                if (target is TargetNpc)
                {
                    TargetNpc tnpc = ((TargetNpc)target);
                    tnpc.NPC.IsPanicking      = false;
                    tnpc.NPC.OnNPCDeathEvent += OnNpcDeath;
                    tnpc.NPC.OnNPCHitEvent   += OnNpcHit;
                }
            }
        }
Exemplo n.º 2
0
        private Target NewTarget()
        {
            Target t = new TargetNpc();

            t.IsHostile = true;
            t.ItemType  = ItemType.P99;
            t.Position  = new Vector3(5, 1, 5);

            Waypoint waypoint = new GameObject().AddComponent <Waypoint>();

            waypoint.Owner    = t;
            waypoint.Position = new Vector3(10, 1, 10);
            t.Waypoints.Add(waypoint);

            return(t);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Spawn an npc
        /// </summary>
        /// <param name="hostile">wether the npc is hostile</param>
        /// <param name="type">what kind of npc is to be spawned</param>
        /// <param name="location">location of the npc</param>
        /// <param name="rotation">rotation of the npc</param>
        private void SpawnNPC(bool hostile, Transform type, Vector3 location, Quaternion rotation)
        {
            // Create npc
            TargetNpc t = new TargetNpc();

            t.Difficulty = difficulty;
            t.ItemType   = ItemType.P99;
            t.Position   = location;
            t.IsHostile  = hostile;

            Targets.Add(t);

            // Spawn npc
            Transform trans = t.Spawn(type);

            t.NPC.OnNPCDeathEvent += OnNPCDeath;
            trans.rotation         = rotation;
        }
Exemplo n.º 4
0
        /// <summary>
        /// loads the targettype of the target
        /// </summary>
        private Target LoadTarget()
        {
            Target target;

            switch (_scenario.TargetType)
            {
            case TargetType.Paper:
                throw new NotImplementedException("I don't know how to make paper targets!");

            case TargetType.Dummy:
                throw new NotImplementedException("I don't know how to make dummy targets!");

            case TargetType.Person:
                target = new TargetNpc();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(target);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get the correct targetType
        /// </summary>
        private static Target GetTarget()
        {
            Target target;

            switch (ScenarioBase.Instance.TargetType)
            {
            case TargetType.Paper:
                throw new NotImplementedException("I don't know how to make paper targets!");

            case TargetType.Dummy:
                target = new TargetNpc();
                break;

            case TargetType.Person:
                target = new TargetNpc();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(target);
        }