예제 #1
0
    protected override void Awake()
    {
        InitializeRB();
        if (!_playerStateMachine)
        {
            _playerStateMachine = gameObject.AddComponent <PlayerStateMachine>();
        }

        if (!_pawnSprite)
        {
            LogMsg("No pawn sprite attached to this object.");
        }
        else
        {
            if (_pawnSprite is PlayerSpriteCont)
            {
                _playerSprite = (PlayerSpriteCont)_pawnSprite;
            }
            else
            {
                LogMsg("There is a sprite attached to the player, but it is not a player sprite!");
            }
        }

        if (_audioController is PlayerAudioController)
        {
            _playerAudioController = (PlayerAudioController)_audioController;
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerAudioController pAudio = collision.gameObject.GetComponent <PlayerAudioController>();

        if (pAudio != null)
        {
            print("Change music");

            if (isMusicFadeOut)
            {
                AM.PlayAudioFadeOut(true);
            }
            else if (isBGFadeOut)
            {
                AM.PlayAudioFadeOut(false);
            }
            else
            {
                if (areaMusic != null && AM.GetCurrentMusicClip().name != areaMusic.name)
                {
                    AM.PlayBGAudioORMusic(areaMusic, true);
                }

                if (areaBG != null && AM.GetCurrentBGClip().name != areaBG.name)
                {
                    AM.PlayBGAudioORMusic(areaBG, false);
                }
            }
        }
    }
    void Start()
    {
        maxSpeed     = INITIAL_SPEED;
        currentSpeed = INITIAL_SPEED;

        jumpAction.performed      += ctx => jump();
        slideAction.performed     += ctx => slide();
        moveLeftAction.performed  += ctx => moveLeft();
        moveRightAction.performed += ctx => moveRight();

        touchContact.started  += ctx => StartTouchPrimary(ctx);
        touchContact.canceled += ctx => EndTouchPrimary(ctx);

        _body              = gameObject.GetComponent <Rigidbody>();
        _collider          = gameObject.GetComponent <BoxCollider>();
        starting_elevation = _body.transform.position.y;

        inventory           = GameObject.Find("Inventory");
        playerInventoryData = inventory.GetComponent <PlayerInventoryData>();
        anim = GameObject.Find("Player Model").GetComponent <Animator>();
        bagWeightText.text = "0";
        audioController    = gameObject.GetComponent <PlayerAudioController>();
        // TODO: set music audio source ignoreListenerPause to true

        moveLeftAction.Enable();
        moveRightAction.Enable();

        touchContact.Enable();
        touchPosition.Enable();
    }
 // Use this for initialization
 void Start()
 {
     Ring                 = GetComponent <ParticleSystem>();
     HaloController       = GetComponent <PlayerHaloController>();
     PlayerAudioScript    = GetComponent <PlayerAudioController>();
     MySoundManagerScript = MySoundManagerObj.GetComponent <MySoundManager>();
 }
예제 #5
0
 void Awake()
 {
     playerAnimator        = GetComponent <Animator>();
     playerSpriteRenderer  = GetComponent <SpriteRenderer>();
     rigidbody2D           = GetComponent <Rigidbody2D>();
     playerAudioController = GetComponent <PlayerAudioController>();
 }
예제 #6
0
 private void Awake()
 {
     //取得此物件的碰撞器
     this.rb = this.gameObject.GetComponent <Rigidbody2D>();
     this.playerController = this.gameObject.GetComponent <PlayerController>();
     this.playerAudio      = this.gameObject.GetComponent <PlayerAudioController>();
 }
예제 #7
0
 void Start()
 {
     _body            = gameObject.GetComponent <Rigidbody>();
     playerController = this.GetComponentInParent <PlayerController>();
     animator         = gameObject.GetComponent <Animator>();
     audioController  = GameObject.FindObjectOfType <PlayerAudioController>();
 }
예제 #8
0
 private void Awake()
 {
     movement              = GetComponent <Movement>();
     mainCamera            = Camera.main.GetComponent <Camera>();
     levelController       = levelObj.GetComponent <LevelController>();
     gravityGun            = GetComponent <GravityGun>();
     playerAudioController = GetComponent <PlayerAudioController>();
 }
예제 #9
0
 void Start()
 {
     interactableLayerMask = ((1 << enemyLayer) | (1 << interactablesLayer));
     pUI       = GetComponent <AirTankController>();
     pCon      = GetComponent <PlayerController>();
     pFeedback = GetComponent <PlayerFeedback>();
     pAudio    = GetComponent <PlayerAudioController>();
     animator  = pCon.animator;
 }
예제 #10
0
	void Start()
	{
		playerAudio = GetComponent<PlayerAudioController>();
		if (isLocalPlayer)
		{
			playerCam = this.GetComponent<PlayerCamera>();
			HUD = GameObject.Find("HUD man").GetComponent<PlayerHUD>();
			HUD.Spawn(gameObject);
		}
	}
예제 #11
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
 void Start()
 {
     _time            = 0;
     _better          = 0;
     currentTime.text = "";
     betterTime.text  = "";
     _initialPos      = player.transform.position;
     Cursor.visible   = false;
     _PMC             = player.GetComponent <PlayerMasterController>();
     _PAC             = player.GetComponent <PlayerAudioController>();
 }
예제 #13
0
    protected override void Start()
    {
        base.Start();

        pFeedback = GetComponent <PlayerFeedback>();
        pAudio    = GetComponent <PlayerAudioController>();
        pHealth   = GetComponent <PlayerHealthSystem>();

        groundLayerMask = ((1 << groundLayer)) | ((1 << breakableFloorsLayer)) | ((1 << slidingSurfaceLayer)) | ((1 << breakableObjectsLayer)) | ((1 << rollingObjectsLayer));
        wallLayerMask   = ((1 << groundLayer)) | ((1 << breakableFloorsLayer)) | ((1 << breakableObjectsLayer));
    }
    void Start()
    {
        pCon      = GetComponent <PlayerController>();
        pAudio    = GetComponent <PlayerAudioController>();
        pFeedback = GetComponent <PlayerFeedback>();
        pInteract = GetComponent <PlayerHandleInteract>();
        windDial  = Toolbox.GetInstance().GetPlayerManager().GetWindDial();
        animator  = GetComponent <Animator>();

        currentPhase           = hurtPhase0;
        healthNodeFlashRoutine = IInjuredFlashRed();
    }
예제 #15
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerAudioController pAudioCon = collision.gameObject.GetComponent <PlayerAudioController>();

        if (pAudioCon != null)
        {
            isPlayerInAudioZone = true;

            if (isWindSoundPlaying)
            {
                borasWindAudioSource.Play();
            }
        }
    }
예제 #16
0
    private void Awake()
    {
        controller    = new PlayerController(this);
        cameraControl = GetComponent <CameraController>();

        view              = GetComponent <View>();
        moveControl       = GetComponent <MoveController>();
        lifeControl       = GetComponent <PlayerLifeController>();
        adrenalineControl = GetComponent <PlayerAdrenalinController>();
        pointsControl     = GetComponent <PlayerPointsController>();
        shootControl      = GetComponent <PlayerShootController>();
        audioControl      = GetComponent <PlayerAudioController>();
        strategyControl   = GetComponent <PlayerStrategyController>();
    }
예제 #17
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        PlayerAudioController pAudioCon = collision.gameObject.GetComponent <PlayerAudioController>();

        if (pAudioCon != null)
        {
            isPlayerInAudioZone = false;

            if (isWindSoundPlaying)
            {
                StopAllCoroutines();
                StartCoroutine(AudioFade(false));
            }
        }
    }
예제 #18
0
 public static bool Marshmallow_Burn(
     ref Marshmallow.MallowState ____mallowState,
     MeshRenderer ____fireRenderer,
     ref float ____toastedFraction,
     ref float ____initBurnTime,
     PlayerAudioController ____audioController)
 {
     if (____mallowState == Marshmallow.MallowState.Default)
     {
         ____fireRenderer.enabled = true;
         ____toastedFraction      = 1f;
         ____initBurnTime         = Time.time;
         ____mallowState          = Marshmallow.MallowState.Burning;
         ____audioController.PlayMarshmallowCatchFire();
         QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Burn);
     }
     return(false);
 }
예제 #19
0
    void Start()
    {
        // Get all references needed
        m_RigidBody      = GetComponent <Rigidbody>();
        m_GameController = FindObjectOfType <GameController>();
        m_GC             = FindObjectOfType <Game>();
        //m_Renderder = GetComponentInChildren<SkinnedMeshRenderer>();
        m_Animations  = GetComponentInChildren <PlayerAnimation>();
        m_PlayerAudio = GetComponent <PlayerAudioController>();

        //effectController = GetComponentInChildren<EffectController>();

        // Get the current device.  Sets the positions for the hand to move to and from
        currentDevice = (int)GameManager.Instance.currentAspect;
        if (currentDevice > 2)
        {
            currentDevice = 2;
        }
    }
예제 #20
0
        public override void Init()
        {
            base.Init();

            priority = TickPriority.High;

            _stateMachineController = GetComponent <PlayerStateMachineController>();
            _movementController     = GetComponent <MovementController>();
            _healthController       = GetComponent <HealthController>();
            _bodyDamageDealer       = GetComponent <BodyDamageDealer>();
            _weaponController       = GetComponent <PlayerWeaponController>();
            _audioController        = GetComponent <PlayerAudioController>();

            AttachComponent(_stateMachineController);
            AttachComponent(_movementController);
            AttachComponent(_healthController);
            AttachComponent(_bodyDamageDealer);
            AttachComponent(_weaponController);
            AttachComponent(_audioController);
        }
    private void Start()
    {
        shotAudio = gameObject.GetComponent <PlayerAudioController>();

        fanShotSpawners = gameObject.transform.GetChild(2).GetComponentsInChildren <Transform>();
    }
 private void Start()
 {
     _playerResources       = Locator.GetPlayerTransform().GetComponent <PlayerResources>();
     _playerAudioController = Locator.GetPlayerAudioController();
 }
	// Use this for initialization
	void Start ()
	{
		playerTran = transform;

		playerAni = GetComponent<NetworkAnimator>();
		charContr = GetComponent<CharacterController>();
		playerAudio = GetComponent<PlayerAudioController>();
		playerCam = GetComponent<PlayerCamera>();

		Transform childCam = playerTran.FindChild("camera");
		if(childCam)
		{
			childCam.GetComponent<Camera>().enabled = isLocalPlayer;
			childCam.GetComponent<AudioListener>().enabled = isLocalPlayer;
		}

		if (team != PlayerTeam.NotPicked)
		{
			Renderer r = GetComponent<Renderer>();
			if(r)
				r.material.color = team == PlayerTeam.TeamYellow ? Color.yellow : Color.blue;
			if (team == PlayerTeam.TeamBlue)
				for (int i = 0; i < charRend.Count; i++)
				{
					charRend[i].material = blueMat[i];
				}
				
			else
				for (int i = 0; i < charRend.Count; i++)
				{
					charRend[i].material = yellowMat[i];
				}
		}

		if (isLocalPlayer)
			localInstance = this;
	}
예제 #24
0
 private void Awake()
 {
     levelController       = levelControllerObj.GetComponent <LevelController>();
     playerAudioController = GetComponent <PlayerAudioController>();
 }