Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        childrenTransforms = gameObject.GetComponentsInChildren <Transform>();
        foreach (Transform t in childrenTransforms)
        {
            if (t.name.Equals("ArmR[1]"))
            {
                rightArm = t;
            }
            if (t.name.Equals("HandR"))
            {
                rightHand = t;
            }
            if (t.name.Equals("ForearmR"))
            {
                rightForearm = t;
            }
        }
        castingScript = objWithCastingEffect.GetComponent <CastingEffect>();

        // In order to set the casting effect layer order, we get the weapon and sum it 1.
        int weaponLayerOrder = getWeaponLayerOrder();

        castingLayerOrder   = weaponLayerOrder + 1;
        soundScript         = GetComponent <CharacterSounds>();
        heroCharacterScript = GetComponent <Character>();
        charControlScript   = GetComponent <CharacterControl>();

        // Enable multitouch for Android.
        Input.multiTouchEnabled = true;
    }
        public virtual bool SetupCharacterSounds()
        {
            bool continute_setup = false;

            AlertProgress("Checking CharacterSounds Dependencies");
            CharacterSounds characterSounds = character.GetComponent <CharacterSounds>();

            if (characterSounds)
            {
                AlertProgress("CharacterSounds Found");
                SetupCharacterSoundsDefaults(characterSounds);
                continute_setup = true;
            }
            else
            {
                AlertProgress(" CharacterSounds not found");
                AlertProgress("Creating CharacterSounds");
                characterSounds = character.AddComponent <CharacterSounds>();
                SetupCharacterSoundsDefaults(characterSounds);
                continute_setup = true;
            }

            AlertProgress("CharacterSounds Setup complete");
            return(continute_setup);
        }
Exemple #3
0
/*
 *	FUNCTION: Play a sound
 */
    public void playSound(CharacterSounds soundType)
    {
        if (bSoundEnabled)
        {
            asCharacterSounds[(int)soundType].Play();
        }
    }
        public static void SetDefaultForMissing(CharacterSounds characterSounds)
        {
            if (characterSounds.damage == null)
            {
                characterSounds.damage = Resources.Load <AudioClip>($"{FoleyPath}404109__deathscyp__damage-1");
            }
            if (characterSounds.damage == null)
            {
                characterSounds.runningStone = Resources.Load <AudioClip>(
                    $"{FoleyPath}Movement/430708__juandamb__running");
            }

            if (characterSounds.sneakingStone == null)
            {
                characterSounds.sneakingStone = Resources.Load <AudioClip>(
                    $"{FoleyPath}Movement/260120__splicesound__01-20-footsteps-tile-slippers-slow-pace");
            }

            if (characterSounds.walkSnow == null)
            {
                characterSounds.walkSnow = Resources.Load <AudioClip>(
                    $"{FoleyPath}Movement/215690__musicbrain__walking-in-snow-1");
            }

            if (characterSounds.walkStone == null)
            {
                characterSounds.walkStone = Resources.Load <AudioClip>(
                    $"{FoleyPath}Movement/208103__phil25__stone-steps");
            }
        }
Exemple #5
0
 private void Start()
 {
     if (characterSounds == null)
     {
         characterSounds = GetComponent <CharacterSounds>();
         Logger.logWarning("Interactable characterSounds is missing and has been automatically assigned. Please assign it manually.");
     }
 }
Exemple #6
0
        public MyPlayerGhost(PlayerCorpse corpse) : base(corpse)
        {
            ownerCorpse    = (MyPlayerCorpse)corpse;
            characterIndex = ownerCorpse.PlayerIndex;
            archerSounds   = TowerFall.ArcherData.Archers[characterIndex].SFX;
            haloProperties.SaveProperties(halo);

            this.arrowPickupHitbox = new WrapHitbox(22f, 30f, -11f, -16f);
        }
Exemple #7
0
/*
 *	FUNCTION: Check if a sound is currently playing.
 */
    public bool isPlaying(CharacterSounds sound)
    {
        if (asCharacterSounds[(int)sound].isPlaying)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemple #8
0
        private void Start()
        {
            playerCameraTransform.rotation = Quaternion.identity;
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;

            _characterSounds = GetComponent <CharacterSounds>();
            _musicManager    = GetComponent <MusicManager>();

            _soundManagers = FindObjectsOfType <MonoBehaviour>().OfType <ISoundManager>().ToList();
        }
    public void StartDialogue(int starterId, CharacterSounds characterSounds)
    {
        _characterSounds = characterSounds;
        HUD.SetActive(false);
        dialogueInterface.SetActive(true);
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible   = true;
        dialogueObject   = dialogueService.GetDialogueObject(starterId);
        _clipRepository  = new DialogueClipRepository();

        StartCoroutine(DialogueLoop());
    }
Exemple #10
0
    protected virtual void Start()
    {
        currentHealth = health;

        unitCollider   = GetComponent <Collider>();
        CharacterAudio = GetComponent <CharacterSounds>();

        if (!animator)
        {
            animator = GetComponent <Animator>();
        }
    }
Exemple #11
0
    void Start()
    {
        ResetView();
        UnityEngine.XR.InputTracking.Recenter();
        //Debug.Log("plactrlstart");
        Application.targetFrameRate = 30;
        //Teleport();

        //transform.position = PlayerManager.instance.startPos.position;

        //Debug.Log(gameObject.transform.position);
        if (lockCursor)
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
        }
        defWalkSpeed = walkSpeed;
        defRunSpeed  = runSpeed;
        sounds       = GetComponent <CharacterSounds>();

        //lastHealth = myStats.currentHealth;
        //player = GetComponent<Transform>();
        myStats    = GetComponent <CharacterStats>();
        imp        = GetComponent <ImpactReceiver>();
        animator   = GetComponent <Animator>();
        cameraT    = Camera.main.transform;
        controller = GetComponent <CharacterController>();

        combat = GetComponent <CharacterCombat>();

        playerState = GameObject.Find("PlayerState");
        if (playerState != null)
        {
            myStats.maxHealth  = playerState.GetComponent <Player>().maxHealth;
            myStats.maxStamina = playerState.GetComponent <Player>().maxStamina;
            myStats.maxDive    = playerState.GetComponent <Player>().maxDive;
            myStats.ableSwim   = playerState.GetComponent <Player>().ableSwim;
            transform.position = playerState.GetComponent <Player>().startPosition;
        }
        enemies = enemys.GetComponentsInChildren <Patrol2>();
    }
Exemple #12
0
    /*
     *	FUNCTION: Stops all sounds except background music
     */
    public void stopAllSounds()
    {
        for (int i = 0; i < CharacterSounds.GetValues(typeof(CharacterSounds)).Length; i++)
        {
            asCharacterSounds [i].Stop();
        }
        for (int i = 0; i < PowerupSounds.GetValues(typeof(PowerupSounds)).Length; i++)
        {
            asPowerupSounds [i].Stop();
        }
        for (int i = 0; i < MenuSounds.GetValues(typeof(MenuSounds)).Length; i++)
        {
            asMenuSounds [i].Stop();
        }
        for (int i = 0; i < EnemySounds.GetValues(typeof(EnemySounds)).Length; i++)
        {
            asEnemySounds [i].Stop();
        }

        bFootstepsPlaying = false;
    }
Exemple #13
0
    public virtual void Initialize(CharacterStats holder, LayerMask attackTo, Transform leftHand = null, Transform rightHand = null)
    {
        // AUDIO ???
        audioController = holder.GetComponent <CharacterSounds>();

        // instatiate models
        if (rightHandWeaponModel && rightHand)
        {
            rightHandModel = Instantiate(rightHandWeaponModel, rightHand);
            rightHandModel.SetActive(false);
        }
        if (leftHandWeaponModel && leftHand)
        {
            leftHandModel = Instantiate(leftHandWeaponModel, leftHand);
            leftHandModel.SetActive(false);
        }

        for (int i = 0; i < WeaponAttacks.Length; i++)
        {
            WeaponAttacks[i].Initialize(attackTo, holder.transform);
        }
    }
        public virtual void SetupCharacterSoundsDefaults(CharacterSounds characterSounds)
        {
            if (characterSounds == false)
            {
                return;
            }
            AlertProgress("Setting Default CharacterSounds values");

            TPCSTCharacterSounds tempCharacterSounds = character_defaults.characterSounds;

            characterSounds.Footstep           = tempCharacterSounds.Footstep;
            characterSounds.Death              = tempCharacterSounds.Death;
            characterSounds.Jump               = tempCharacterSounds.Jump;
            characterSounds.Land               = tempCharacterSounds.Land;
            characterSounds.Block              = tempCharacterSounds.Block;
            characterSounds.Hurt               = tempCharacterSounds.Hurt;
            characterSounds.Hit                = tempCharacterSounds.Hit;
            characterSounds.BigHit             = tempCharacterSounds.BigHit;
            characterSounds.BigDamageThreshold = tempCharacterSounds.BigDamageThreshold;

            AlertProgress("Setting Default CharacterSounds values complete");
        }
	/*
	*	FUNCTION: Play a sound
	*/
	public void playSound (CharacterSounds soundType)
	{
		if (bSoundEnabled)
			asCharacterSounds [(int)soundType].Play ();
	}
Exemple #16
0
 // Use this for initialization
 void Start()
 {
     audso = GetComponentInParent <CharacterSounds> ();
     //		audso = this.gameObject.GetComponent<CharacterSounds> ();
 }
	/*
	*	FUNCITON: Stop a sound
	*/
	public void stopSound (CharacterSounds soundType)
	{
		asCharacterSounds [(int)soundType].Stop ();
	}
Exemple #18
0
/*
 *	FUNCITON: Stop a sound
 */
    public void stopSound(CharacterSounds soundType)
    {
        asCharacterSounds[(int)soundType].Stop();
    }
	/*
	*	FUNCTION: Check if a sound is currently playing.
	*/
	public bool isPlaying (CharacterSounds sound)
	{
		if (asCharacterSounds [(int)sound].isPlaying)
			return true;
		else
			return false;
	}
 // Use this for initialization
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     audso            = gameObject.GetComponent <CharacterSounds> ();
     rb = gameObject.GetComponent <Rigidbody> ();
 }