// Start is called before the first frame update
    void Start()
    {
        //coletando componentes
        anim        = this.gameObject.GetComponent <Animator> ();
        rigb        = this.gameObject.GetComponent <Rigidbody2D> ();
        trs         = this.gameObject.GetComponent <Transform> ();
        spr         = this.gameObject.GetComponent <SpriteRenderer> ();
        camcontroll = GameObject.FindWithTag("MainCamera").gameObject.GetComponent <CameraBehavior>();
        lifeBar     = HealthBar.Instance.GetComponent <HealthBar>();
        movSen      = 1;
        lstmovSen   = 1;
        life        = maxlife;

        Vector2 chckpos = CheckPointManager.GetLastCheckPoint();

        if (chckpos != Vector2.zero)
        {
            GameEvents.ScreamEvent("CheckPointFound");
            trs.position = chckpos;
            playable     = true;
        }

        playable = true;
        InPut    = InputManager.instance;
    }
Example #2
0
    private void Start()
    {
        checkPointManager  = CheckPointManager.instance;
        transform.position = checkPointManager.GetLastCheckPoint().transform.position;
        hasGun             = checkPointManager.hadGun;

        SetMovementRelation();
        GetMovmentDir(GameManager.Instance.mainCamera.transform);
    }
    void Start()
    {
        cam = GetComponent <Camera>();
        checkPointManager = CheckPointManager.instance;
        CheckPoint lastCheckPoint = checkPointManager.GetLastCheckPoint();

        if (lastCheckPoint == null)
        {
            Debug.LogError("Initial checkpoint not found!");
        }

        transform.position = lastCheckPoint.CameraPoint.position;
        transform.rotation = lastCheckPoint.CameraPoint.rotation;
        cam.orthographic   = lastCheckPoint.isortographic;

        if (lastCheckPoint.isortographic)
        {
            cam.orthographicSize = lastCheckPoint.camerasize;
        }

        cam.GetComponent <CameraController>().SetCameraFollowPlayer(true);
    }