Пример #1
0
    void Start()
    {
        _gameManager = GameManager.instance;
        if (_gameManager != null)
        {
            foreach (UpgradeStruct us in _gameManager._allUpgrades)
            {
                if (us.upgradeValues[0].upgradeType == UpgradeType.ParrotUpgrade)
                {
                    if (us.Purchased)
                    {
                        _parrotActive = true;
                    }
                    break;
                }
            }
        }
        anim          = GetComponentInChildren <Animator>();
        baseAnimSpeed = anim.speed;

        mainCamera = FindObjectOfType <SmoothCam>();

        // Effects
        Vector3    offset   = transform.up * 2 + transform.forward * 0.35f;
        GameObject drunkObj = (GameObject)Instantiate(drunkEffect, transform.position + offset, transform.rotation);

        drunkObj.transform.parent = transform;
        drunkParticles            = drunkObj.GetComponent <ParticleSystem>();
        GameObject soberObj = (GameObject)Instantiate(soberEffect, transform.position + offset, transform.rotation);

        soberObj.transform.parent = transform;
        soberParticles            = soberObj.GetComponent <ParticleSystem>();

        ragdoll          = GetComponentInChildren <PirateCharacterAnimator>();
        sceneManager     = SceneManager_Andrew.instance;
        startingRotation = transform.rotation;
        startingPosition = transform.position;
        controller       = GetComponent <CharacterController>();
        lg = GameObject.FindGameObjectWithTag("LevelGen").GetComponent <ProcGen>();
        //debugText = GameObject.Find("DEBUG").GetComponent<Text>(); // Quick and dirty debugging

        jumpSound   = (AudioClip)Resources.Load("Sounds/player_jump");
        splashSound = (AudioClip)Resources.Load("Sounds/player_splash");
        smackSound  = (AudioClip)Resources.Load("Sounds/player_smack");
        deckSound   = (AudioClip)Resources.Load("Sounds/deck_jump");
        landSound   = (AudioClip)Resources.Load("Sounds/player_land");
        skidSound   = (AudioClip)Resources.Load("Sounds/player_skid");

        ResetCharacter();
    }
Пример #2
0
    void Start()
    {
        _gameManager = GameManager.instance;
        if(_gameManager != null)
        {
            foreach (UpgradeStruct us in _gameManager._allUpgrades)
            {
                if (us.upgradeValues[0].upgradeType == UpgradeType.ParrotUpgrade)
                {
                    if (us.Purchased)
                    {
                        _parrotActive = true;
                    }
                    break;
                }
            }
        }
        anim = GetComponentInChildren<Animator>();
        baseAnimSpeed = anim.speed;

        mainCamera = FindObjectOfType<SmoothCam>();

        // Effects
        Vector3 offset = transform.up * 2 + transform.forward * 0.35f;
        GameObject drunkObj = (GameObject)Instantiate(drunkEffect, transform.position + offset, transform.rotation);
        drunkObj.transform.parent = transform;
        drunkParticles = drunkObj.GetComponent<ParticleSystem>();
        GameObject soberObj = (GameObject)Instantiate(soberEffect, transform.position + offset, transform.rotation);
        soberObj.transform.parent = transform;
        soberParticles = soberObj.GetComponent<ParticleSystem>();

        ragdoll = GetComponentInChildren<PirateCharacterAnimator>();
        sceneManager = SceneManager_Andrew.instance;
        startingRotation = transform.rotation;
        startingPosition = transform.position;
        controller = GetComponent<CharacterController>();
        lg = GameObject.FindGameObjectWithTag("LevelGen").GetComponent<ProcGen>();
        //debugText = GameObject.Find("DEBUG").GetComponent<Text>(); // Quick and dirty debugging

        jumpSound = (AudioClip)Resources.Load("Sounds/player_jump");
        splashSound = (AudioClip)Resources.Load("Sounds/player_splash");
        smackSound = (AudioClip)Resources.Load("Sounds/player_smack");
        deckSound = (AudioClip)Resources.Load("Sounds/deck_jump");
        landSound = (AudioClip)Resources.Load("Sounds/player_land");
        skidSound = (AudioClip)Resources.Load("Sounds/player_skid");

        ResetCharacter();
    }