Esempio n. 1
0
        public MapGenerator(IRMap map, IMobPackManager mobPackManager)
        {
            _map                = map;
            _mobPackManager     = mobPackManager;
            _rows               = map.Rows;
            _cols               = map.Columns;
            _directions         = RHelper.GetDirections();
            _oppositeDirections = new Dictionary <Direction, Direction>
            {
                { Direction.North, Direction.South },
                { Direction.East, Direction.West },
                { Direction.South, Direction.North },
                { Direction.West, Direction.East },
                { Direction.Center, Direction.Center }
            };

            var roomGen         = new RoomGenerator(5, 5, 10, 10, _map);
            var corridorGen     = new HallwayGenerator(20, 20, 50, 50, _map);
            var drunkDrigger    = new DrunkDigger(50, 50, 100, 100, _map);
            var treasureRoomGen = new TreasureRoom(5, 5, 13, 13, _map);

            _generators = new RandomContainer <IGenerator>
            {
                { roomGen, 60 },
                { corridorGen, 5 },
                { drunkDrigger, 180 },
                { treasureRoomGen, 2 }
            };

            roomGen.EnableEnemySpawning(_mobPackManager, 15);
            drunkDrigger.EnableEnemySpawning(_mobPackManager, 20);
        }
Esempio n. 2
0
 // Start is called before the first frame update
 void Start()
 {
     myRB    = GetComponent <Rigidbody2D>();
     myAnim  = GetComponent <Animator>();
     dead    = false;
     randomC = GetComponent <RandomContainer>();
 }
Esempio n. 3
0
        public static float[,,] Create3DNoise(int smoothness,
                                              int nodesWidthCount,
                                              int nodesHeightCount,
                                              int nodesDepthCount,
                                              int segmentSize,
                                              int seed = 0)
        {
            List <float[, , ]> nodesLayers = new List <float[, , ]>();

            for (int i = 0; i < smoothness; i++)
            {
                float[,,] layer = new float[nodesWidthCount, nodesHeightCount, nodesDepthCount];
                for (int j = 0; j < nodesWidthCount; j++)
                {
                    for (int k = 0; k < nodesHeightCount; k++)
                    {
                        for (int l = 0; l < nodesDepthCount; l++)
                        {
                            layer[j, k, l] = (float)RandomContainer.GetDouble(BottomNoiseBound(i), TopNoiseBound(i), seed);
                        }
                    }
                }
                nodesLayers.Add(layer);
            }
            return(VolumeInterpolation.MultiDerpByNodes(nodesLayers, segmentSize));
        }
Esempio n. 4
0
 // Start is called before the first frame update
 void Start()
 {
     Col       = GetComponent <BoxCollider2D>();
     randomCon = GetComponent <RandomContainer>();
     SpriteRen = GetComponent <SpriteRenderer>();
     DinoDuck  = GetComponent <Animation>();
     Anim      = GetComponent <Animator>();
 }
Esempio n. 5
0
    public void Play(string name)
    {
        RandomContainer soundContainer = Array.Find(sounds, sound => sound.name == name);
        var             i = Random.Range(0, soundContainer.clip.Length);

        soundContainer.source.clip = soundContainer.clip[i];
        soundContainer.source.Play();
        Debug.Log("Last sound played: " + soundContainer.clip[i].name);
    }
 // Start is called before the first frame update
 void Start()
 {
     GameOver = GameObject.Find("Game Over");
     Restart  = GameObject.Find("Restart");
     GameOver.SetActive(false);
     Restart.SetActive(false);
     CurrentScore = 0;
     HighScore    = 0;
     randomCon    = GetComponent <RandomContainer>();
     ChangeSeason();
 }
Esempio n. 7
0
    private void Start()
    {
        //Indicate we have not started and the game is not over yet.
        gameStarted = false;
        gameOver    = false;

        //Sets the static score to 0 so that score does not carry over on reload of this scene.
        score = 0;

        randCont = GetComponent <RandomContainer>();
    }
Esempio n. 8
0
        public static float[] Create1DNoise(int smoothness,
                                            int nodesCount,
                                            int segmentSize,
                                            int seed = 0)
        {
            List <float[]> nodesLayers = new List <float[]>();

            for (int i = 0; i < smoothness; i++)
            {
                nodesLayers.Add(RandomContainer.GetDoubleArray(BottomNoiseBound(i), TopNoiseBound(i), nodesCount, seed).Select(e => (float)e).ToArray());
            }
            return(SequenceInterpolation.MultiDerpSequenceByNodes(nodesLayers, segmentSize));
        }
    // Start is called before the first frame update
    void Start()
    {
        GameControl = GameObject.Find("GameControl");
        myAnimator  = gameObject.GetComponentInChildren <Animator>();
        randomC     = GetComponent <RandomContainer>();

        OriginalPosition = gameObject.transform.position;

        //set groundPosition to top of ground platform Y.
        groundPosition = GameObject.FindWithTag(groundToFind).transform.position.y;

        currJumpCooldown = maxJumpCooldown;

        //set pos
        newXPos = transform.position;
    }
Esempio n. 10
0
            private IClipContainer CreateContainer(string containerId, SampleContainerChildType childType)
            {
                switch (childType)
                {
                case SampleContainerChildType.Random:
                {
                    RandomContainer randomContainer = new RandomContainer();
                    randomContainer.id = containerId;
                    return(randomContainer);
                }

                case SampleContainerChildType.Choice:
                {
                    SwitchContainer switchContainer = new SwitchContainer();
                    switchContainer.id = containerId;
                    return(switchContainer);
                }

                case SampleContainerChildType.Start:
                case SampleContainerChildType.Loop:
                case SampleContainerChildType.Stop:
                {
                    LoopContainer loopContainer = new LoopContainer();
                    loopContainer.id = containerId;
                    return(loopContainer);
                }

                case SampleContainerChildType.None:
                {
                    RandomContainer randomContainer = new RandomContainer();
                    randomContainer.id = containerId;
                    return(randomContainer);
                }

                default:
                    throw new InvalidOperationException();
                }
            }
Esempio n. 11
0
        public HIRCObject(BNK mainBnk, BinaryReader br)
        {
            Bnk = mainBnk;
            if (!hircError.errorOccured)
            {
                int type = br.ReadByte();
                LastPos = br.BaseStream.Position;
                switch (type)
                {
                case 1:
                    SettingsObject = new Settings(br, type);
                    break;

                case 2:
                    SoundSFXObject = new SoundSFX(this, br, type);
                    break;

                case 3:
                    EventAction = new EventAction(this, br, type);
                    break;

                case 4:
                    Event = new Event(this, br, type);
                    break;

                case 5:
                    RandomContainer = new RandomContainer(this, br, type);
                    break;

                case 6:
                    SwitchContainer = new SwitchContainer(this, br, type);
                    break;

                case 7:
                    ActorMixer = new ActorMixer(this, br, type);
                    break;

                case 8:
                    AudioBus = new AudioBus(this, br, type);
                    break;

                case 9:
                    BlendContainer = new BlendContainer(this, br, type);
                    break;

                case 10:
                    MusicSegment = new MusicSegment(this, br, type);
                    break;

                case 11:
                    MusicTrack = new MusicTrack(this, br, type);
                    break;

                case 12:
                    MusicSwitchContainer = new MusicSwitchContainer(this, br, type);
                    break;

                case 13:
                    MusicSequence = new MusicSequence(this, br, type);
                    break;

                case 14:
                    Attenuation = new Attenuation(br, type);
                    break;

                case 16:
                    FeedbackBus = new FeedbackBus(this, br, type);
                    break;

                case 17:
                    FeedbackNode = new FeedbackNode(this, br, type);
                    break;

                case 18:
                    FxShareSet = new FxShareSet(this, br, type);
                    break;

                case 19:
                    FxCustom = new FxCustom(this, br, type);
                    break;

                case 20:
                    AuxiliaryBus = new AuxiliaryBus(this, br, type);
                    break;

                case 21:
                    LFO = new LFO(br, type);
                    break;

                case 22:
                    Envelope = new Envelope(br, type);
                    break;

                default:
                    int length = br.ReadInt32();
                    br.BaseStream.Position -= 5;
                    Data = br.ReadBytes(length + 5);
                    System.Windows.MessageBox.Show("Detected unkown HIRC Object type at: " + (LastPos - 1).ToString("X"), "Toolkit");
                    break;
                }
            }
        }
Esempio n. 12
0
        public int GetLength()
        {
            int length = 5;

            if (SettingsObject != null)
            {
                length += SettingsObject.GetLength();
            }
            else if (SoundSFXObject != null)
            {
                length += SoundSFXObject.GetLength();
            }
            else if (EventAction != null)
            {
                length += EventAction.GetLength();
            }
            else if (Event != null)
            {
                length += Event.GetLength();
            }
            else if (RandomContainer != null)
            {
                length += RandomContainer.GetLength();
            }
            else if (SwitchContainer != null)
            {
                length += SwitchContainer.GetLength();
            }
            else if (ActorMixer != null)
            {
                length += ActorMixer.GetLength();
            }
            else if (AudioBus != null)
            {
                length += AudioBus.GetLength();
            }
            else if (BlendContainer != null)
            {
                length += BlendContainer.GetLength();
            }
            else if (MusicSegment != null)
            {
                length += MusicSegment.GetLength();
            }
            else if (MusicTrack != null)
            {
                length += MusicTrack.GetLength();
            }
            else if (MusicSwitchContainer != null)
            {
                length += MusicSwitchContainer.GetLength();
            }
            else if (MusicSequence != null)
            {
                length += MusicSequence.GetLength();
            }
            else if (Attenuation != null)
            {
                length += Attenuation.GetLength();
            }
            else if (FeedbackNode != null)
            {
                length += FeedbackNode.GetLength();
            }
            else if (FxShareSet != null)
            {
                length += FxShareSet.GetLength();
            }
            else if (FxCustom != null)
            {
                length += FxCustom.GetLength();
            }
            else if (AuxiliaryBus != null)
            {
                length += AuxiliaryBus.GetLength();
            }
            else if (LFO != null)
            {
                length += LFO.GetLength();
            }
            else if (Envelope != null)
            {
                length += Envelope.GetLength();
            }
            else if (FeedbackBus != null)
            {
                length += FeedbackBus.GetLength();
            }
            else
            {
                if (Data != null)
                {
                    length += Data.Length;
                }
                else
                {
                    length = -1;
                }
            }

            return(length);
        }
Esempio n. 13
0
 private void Awake()
 {
     _anim   = GetComponent <Animator> ();
     randomC = GetComponent <RandomContainer>();
 }