Beispiel #1
0
        private void Start()
        {
            playerController = new PlayerController();
            BLL.PlayerFunctions playerFunctions = new BLL.PlayerFunctions();

            #region [GetComponents]
            PlayerAnimator       = gameObject.GetComponent <Animator>();
            PlayerSpriteRenderer = gameObject.GetComponent <SpriteRenderer>();
            colliderTransform    = GetComponent <BoxCollider2D>();
            PlayerCollider2D     = gameObject.GetComponent <CapsuleCollider2D>();
            #endregion

            #region [Camera]
            camera = GameObject.FindGameObjectWithTag("camera");
            cv     = camera.GetComponent <CameraView>();
            playerController.SetFieldOfView(gameObject.GetComponentInChildren <FieldOfView>());
            #endregion

            #region [Model]
            //model = playerFunctions.GetDataViewModel(DAL.ProjectVikingsContext.defaultPlayer);
            model             = playerController.GetInitialData(id, gameObject);
            model.ForceToWalk = false;
            model.ForceToStop = false;
            #endregion

            #region [LifeBar]
            rectT         = LifeBar.GetComponent <RectTransform>();
            LifeBar.value = CalculateLife();
            SetSlideSizes();
            #endregion

            halfSizeY = PlayerSpriteRenderer.size.y / 2;
            if (model.IsBeingControllable)
            {
                camera.SendMessage("UpdatePlayerTranform");
            }

            manager = SAP2D.SAP2DManager.singleton;
            Config  = ScriptableObject.CreateInstance <SAP2D.PathfindingConfig2D>();

            StartCoroutine(FindPath());
        }
Beispiel #2
0
 public PlayerController()
 {
     manager = SAP2D.SAP2DManager.singleton;
 }