Example #1
0
    public void ChangeFootstep(int underGround)
    {
        //set switches and currUnderground
        switch (underGround)
        {
        case 1:     //stone
            surfaceStone.SetValue(this.gameObject);
            currUnderground = Underground.Stone;
            break;

        case 2:     //gravel
            surfaceGravel.SetValue(this.gameObject);
            currUnderground = Underground.Gravel;
            break;

        case 3:     //grass
            surfaceGrass.SetValue(this.gameObject);
            currUnderground = Underground.Grass;
            break;

        case 4:     //bush
            surfaceBush.SetValue(this.gameObject);
            currUnderground = Underground.Bush;
            break;

        default:     //stone
            surfaceStone.SetValue(this.gameObject);
            currUnderground = Underground.Stone;
            break;
        }
    }
Example #2
0
    public void ChangeFootstep(int underGround) //CHANGES CURRENT UNDERGROUND TYPE
    {
        //set switches
        switch (underGround)
        {
        case 1:     //stone
            //surfaceStone.SetValue(this.gameObject);
            currUnderground = Underground.Stone;
            break;

        case 2:     //gravel
            //surfaceGravel.SetValue(this.gameObject);
            currUnderground = Underground.Gravel;
            break;

        case 3:     //grass
            //surfaceGrass.SetValue(this.gameObject);
            currUnderground = Underground.Grass;
            break;

        case 4:     //bush
            //surfaceBush.SetValue(this.gameObject);
            currUnderground = Underground.Bush;
            break;

        default:     //stone
            //surfaceStone.SetValue(this.gameObject);
            currUnderground = Underground.Stone;
            break;
        }
    }
Example #3
0
    // Use this for initialization
    void Awake()
    {
        m_agent = GetComponent <NavMeshAgent>();
        //surfaceStone.SetValue(this.gameObject);

        maxDistance = AkSoundEngine.GetMaxRadius(this.gameObject);

        currUnderground = Underground.Stone;
    }
Example #4
0
        public void LoadSounds()
        {
            GainOneUp                       = content.Load <SoundEffect>("smb_1-up");
            GainPowerUp                     = content.Load <SoundEffect>("smb_powerup");
            Coin                            = content.Load <SoundEffect>("smb_coin");
            CoinScore                       = content.Load <SoundEffect>("smb_coin_score");
            PowerUpAppears                  = content.Load <SoundEffect>("smb_powerup_appears");
            BlockBump                       = content.Load <SoundEffect>("smb_bump");
            BlockBreaking                   = content.Load <SoundEffect>("smb_breakblock");
            SmallJump                       = content.Load <SoundEffect>("smb_jump-small");
            BigJump                         = content.Load <SoundEffect>("smb_jump-super");
            PowerDown                       = content.Load <SoundEffect>("smb_pipe");
            EnemyStomp                      = content.Load <SoundEffect>("smb_stomp");
            EnemyKick                       = content.Load <SoundEffect>("smb_kick");
            MarioDeath                      = content.Load <SoundEffect>("smb_mariodie");
            Fireball                        = content.Load <SoundEffect>("smb_fireball");
            Flagpole                        = content.Load <SoundEffect>("smb_flagpole");
            LevelClear                      = content.Load <SoundEffect>("smb_stage_clear");
            TimeWarning                     = content.Load <SoundEffect>("smb_warning");
            TimeRunningOutOverworld         = content.Load <SoundEffect>("Overworld_Theme_Fast");
            TimeRunningOutStar              = content.Load <SoundEffect>("Star_Theme_Fast");
            WorldClear                      = content.Load <SoundEffect>("smb_world_clear");
            Fireworks                       = content.Load <SoundEffect>("smb_fireworks");
            GamePause                       = content.Load <SoundEffect>("smb_pause");
            GameOver                        = content.Load <SoundEffect>("smb_gameover");
            LevelComplete                   = content.Load <SoundEffect>("smb_level_complete");
            Star                            = content.Load <SoundEffect>("Star Theme");
            OverWorld                       = content.Load <SoundEffect>("Overworld_Theme");
            Underground                     = content.Load <SoundEffect>("smb_underground");
            YourCodeSucks                   = content.Load <SoundEffect>("YourCodeSucks");
            Laugh                           = content.Load <SoundEffect>("NormalLaugh");
            EvilLaugh                       = content.Load <SoundEffect>("EvilLaugh");
            YoshiSound                      = content.Load <SoundEffect>("YoshiSound");
            EggHatchingSound                = content.Load <SoundEffect>("EggHatchingSound");
            YoshiTongueSound                = content.Load <SoundEffect>("YoshiTongueSound");
            YoshiSwallowSound               = content.Load <SoundEffect>("YoshiSwallowSound");
            Dubstep                         = content.Load <SoundEffect>("Dubstep");
            UndergroundInstance             = Underground.CreateInstance();
            OverWorldInstance               = OverWorld.CreateInstance();
            StarInstance                    = Star.CreateInstance();
            TimeRunningOutOverworldInstance = TimeRunningOutOverworld.CreateInstance();
            TimeRunningOutStarInstance      = TimeRunningOutStar.CreateInstance();
            TimeWarningInstance             = TimeWarning.CreateInstance();
            LevelCompleteInstance           = LevelComplete.CreateInstance();
            GameOverInstance                = GameOver.CreateInstance();
            DubstepInstance                 = Dubstep.CreateInstance();

            TimeWarningInstance.IsLooped = false;
        }
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        enemies = new List <Enemy>();
        foes    = new List <IAttack>();
        Flying      enemy1 = new Flying();
        Flying      enemy2 = new Flying();
        Grounded    enemy3 = new Grounded();
        Grounded    enemy4 = new Grounded();
        Underground enemy5 = new Underground();

        enemies.Add(enemy1);
        enemies.Add(enemy2);
        enemies.Add(enemy3);
        enemies.Add(enemy4);
        enemies.Add(enemy5);
        foes.Add(enemy1);
        foes.Add(enemy2);
        foes.Add(enemy3);
        foes.Add(enemy4);
        foes.Add(enemy5);
    }
Example #6
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Underground underground   = null;
        float       floorDistance = 9999;
        var         raycastHits   = Physics.RaycastAll(new Ray(transform.position, Vector3.down), 3, 1 << 8);

        foreach (var hit in raycastHits)
        {
            if (hit.distance < floorDistance)
            {
                var _underground = hit.transform.GetComponent <Underground>();
                if (_underground)
                {
                    underground   = _underground;
                    floorDistance = hit.distance;
                }
            }
        }

        float     floorModifier = underground ? underground.movementSpeed : 1;
        AudioClip audioClip     = underground ? underground.walkingSound : null;

        if (audioClip)
        {
            foreach (var audioSource in GetComponents <AudioSource>())
            {
                if (audioSource.outputAudioMixerGroup.name == "Steps")
                {
                    if (!audioSource.isPlaying)
                    {
                        audioSource.PlayOneShot(audioClip);
                    }
                }
            }
        }

        var transformedDirection = transform.rotation *
                                   new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));

        transformedDirection = 0.1f * floorModifier * transformedDirection.normalized;

        Debug.DrawRay(transform.position, transformedDirection);
        var characterController = GetComponent <CharacterController>();

        characterController.Move(transformedDirection);

        velocityY -= 0.4f * Time.fixedDeltaTime;
        characterController.Move(new Vector3(0, velocityY, 0));

        if (characterController.isGrounded)
        {
            groundedDuration += Time.fixedDeltaTime;
            velocityY         = 0;
            if (Input.GetKey("space") && groundedDuration > 0.5)
            {
                velocityY = 0.2f;
            }
        }
        else
        {
            groundedDuration = 0;
        }

        GetComponent <Animator>().SetBool("Jumping", !characterController.isGrounded);
        GetComponent <Animator>().SetBool("Walking", transformedDirection.magnitude > 0);

        float mouseAccel = 3000 * Screen.width / 1920;

        if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            mouseAccel /= 100;
        }

        var deltaX = mouseAccel * Time.deltaTime * Input.GetAxis("Mouse X");

        transform.Rotate(Vector3.up, deltaX);

        if (pickedUp)
        {
            pickedUp.transform.localPosition = transform.rotation * -transform.forward;
        }
    }