Example #1
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }


        // Text manager
        TextManagerScreenCanvas = Resources.Load <GameObject>("ScreenCanvas");
        DamageTextParent        = Resources.Load <APopupText>("DamageTextParent");
        IncrementProgress();

        // Room generation
        AllRegularRooms = Resources.LoadAll <GameObject>("Regular");
        AllBossRooms    = Resources.LoadAll <GameObject>("Boss");
        IncrementProgress();

        // Bullets
        EnemyBullet        = Resources.Load <GameObject>("EnemyBullet");
        EnemySpawnerBullet = Resources.Load <GameObject>("EnemySpawnerBullet");
        Bullet             = Resources.Load <GameObject>("Bullet");
        ImmolationBullet   = Resources.Load <GameObject>("ImmolationBullet");
        MeleeBullet        = Resources.Load <GameObject>("MeleeBullet");
        PlayerMeleeBullet  = Resources.Load <GameObject>("PlayerMeleeBullet");
        ShieldBullet       = Resources.Load <GameObject>("ShieldBullet");
        SpecialBullet      = Resources.Load <GameObject>("SpecialBullet");
        IncrementProgress();

        // Audio
        string[] songsToLoad = { "overworld", "spooky", "fight" };
        foreach (string song in songsToLoad)
        {
            Songs.Add(
                new AudioClip[] {
                (Resources.Load(song + "-1") as AudioClip),
                (Resources.Load(song + "-2") as AudioClip)
            });
        }
        string[] soundsToLoad = { "crash1",   "crash2",   "crash3",   "crash4",
                                  "plopp1",   "plopp2",   "mouth1-1", "mouth2-1",
                                  "mouth3-1", "mouth4-1", "mouth5-1", "tssss1",
                                  "tssss2",   "pew1",     "shield",   "swish1" };
        foreach (string sound in soundsToLoad)
        {
            Sounds.Add(Resources.Load(sound) as AudioClip);
        }
        IncrementProgress();

        // Misc
        Player      = Resources.Load <GameObject>("Player3D");
        AllPowerups = Resources.LoadAll <GameObject>("powerups");
        IncrementProgress();
    }
Example #2
0
 void Start()
 {
     noise = new PerlinNoise(Seed);
     Map   = PrefabRepository.Instance.Map;
     _repo = PrefabRepository.Instance;
     Random.InitState(Seed);
     World       = new World(-128, 128, -32, 32);
     World.Seed  = Seed;
     _repo.World = World;
     RegenerateMap();
     LoadMap();
 }
Example #3
0
    public Tile(PrefabRepository prefabRepo, int xCoord, int yCoord, int tileCode, int elementCode)
    {
        _prefabRepository = prefabRepo;

        //Determine tile information and buffer in use
        type    = new TileType(tileCode);
        element = new TileElement(elementCode);
        if (!type.Buffer.IsDeadBuffer())
        {
            buffer = type.Buffer;
        }
        else
        {
            buffer = element.Buffer;
        }
        entities = new LinkedList <Entity>();

        //Create world representation of tile
        gridCoordinates = new CoordinatePair(xCoord, yCoord);
        position        = GridRepository.Instance.PositionFromGridCoordinates(gridCoordinates);
        CreateGameObjectRepresentation();
    }
Example #4
0
        public Task <bool> CreateRole([NotNull] CreateRoleOption option)
        {
            if (option == null)
            {
                throw new ArgumentNullException(nameof(option));
            }

            option.Name = option.Name?.Trim() ?? throw new ArgumentNullException(nameof(option.Name));
            if (option.Name.Length < 3)
            {
                throw new ArgumentOutOfRangeException(nameof(option.Name));
            }

            Entity role;

            switch (option.Race)
            {
            case Race.Human:
            {
                role = PrefabRepository.GetPrefab("human.init").Clone();
            }

            break;

            default:

                throw new ArgumentOutOfRangeException();
            }

            Mapper.Map(option, role.Get <UnitComponent>());
            role.Name = option.Name;
            role.Get <PositionComponent>().Pos = Config.Cfg.SpawnPoint;
            EntityRepository.SaveEntity(role);
            Roles.Add(role);

            Logger.Info($"New role {option.Name} has been added");

            return(Task.FromResult(true));
        }
Example #5
0
    /// <summary>
    /// MONOBEHAVIOUR Start
    /// </summary>
    void Start()
    {
        //Get the reference to the used prefab repository and initialize it
        PrefabRepository prefabRepository = GetComponent <PrefabRepository>();

        prefabRepository.InitializeDictionaries();

        //Setup the grid and load the map
        GridRepository gridRepository = GridRepository.Instance;

        gridRepository.LinkPrefabRepository(prefabRepository);
        LoadMap();

        //<TEMPORARY> Spawn a test player
        GameObject playerPrefab = prefabRepository.PrefabOfPlayer();
        GameObject player       = GameObject.Instantiate(playerPrefab, new Vector3(1.5f, 1.5f, 0), Quaternion.identity) as GameObject;

        player.GetComponent <PlayerActionController>().LinkPrefabRepository(prefabRepository);

        //<TEMPORARY> Spawn a test player
        GameObject bystanderPrefab = prefabRepository.PrefabOfBystander();
        GameObject bystander       = GameObject.Instantiate(bystanderPrefab, new Vector3(1.5f, 2.5f, 0), Quaternion.identity) as GameObject;
    }
Example #6
0
 /// <summary>
 /// Keeps the provided PrefabRepository as reference, using it when necessary.
 /// </summary>
 /// <param name="prefabRepo">The repository to reference.</param>
 public void LinkPrefabRepository(PrefabRepository prefabRepo)
 {
     prefabRepository = prefabRepo;
 }
Example #7
0
 public void GetComponents()
 {
     PrefabRepository = gameObject.GetComponent(typeof(PrefabRepository)) as PrefabRepository;
     MazeGenerator    = gameObject.GetComponent(typeof(MazeGenerator)) as MazeGenerator;
     MazeGenerator.LoadPrefabRepository(this.PrefabRepository);
 }
Example #8
0
 private void Awake()
 {
     instance = this;
 }
 public TazerController(PrefabRepository prefabRepo) : base(prefabRepo)
 {
     ;
 }
 public KnifeController(PrefabRepository prefabRepo) : base(prefabRepo)
 {
     ;
 }
Example #11
0
 public void LoadPrefabRepository(PrefabRepository prefabRepository)
 {
     this.PrefabRepository = prefabRepository;
 }
 public EquipmentController(PrefabRepository prefabRepo)
 {
     this.prefabRepo = prefabRepo;
     ammo            = StartingAmmo;
 }