Example #1
0
    // Use this for initialization
    void Start()
    {

        Transform StartPosition = this.transform;
        switch (GameController._instance.GetLastChangeSceneType())
        {
            case EntryType.Up:
                {
                    StartPosition = GameObject.FindGameObjectWithTag(Tags.UpPosition).transform;
                    break;
                }
            case EntryType.Down:
                {
                    StartPosition = GameObject.FindGameObjectWithTag(Tags.DownPosition).transform;
                    break;
                }
            case EntryType.Portal:
                {
                    StartPosition = GameObject.FindGameObjectWithTag(Tags.PortalPosition).transform;
                    break;
                }
        }

        this.transform.position = StartPosition.position;

        _instance = this;
        playerState = PlayerState._instance;
        playerRigidbody = GetComponent<Rigidbody>();
        playerAgent = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = this.GetComponent<HashIDs>();
        audioStepSound = this.GetComponent<AudioSource>();
        anim.SetLayerWeight(1, 1f);
        //FOR DEBUG
        playerState.PlayerStateChanged(PlayerStateChangeType.all);
    }