//  PlayerController pc;


    void Start()
    {

        focusArea = new FocusArea(target.bounds, focusAreaSize);
        // pc = player.GetComponent<PlayerController>();

    }
    void Start()
    {
        gameControl = GameObject.FindGameObjectWithTag("GameController");

        target = GameObject.FindGameObjectWithTag("Player").transform.GetComponent<Controller2D>();
        focusArea = new FocusArea (target.collider.bounds, focusAreaSize);
    }
    void Start()
    {
        min = bounds.bounds.min;
        max = bounds.bounds.max;
        orthographicSize = GetComponent<Camera>().orthographicSize;

        focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
    }
 public void SetTargetPlayer(GameObject targetPlayer)
 {
     this.targetPlayer = targetPlayer;
     //Create array of non-main player objects
     this.targetController = this.targetPlayer.GetComponent<BBController3D>();
     this.targetPlayerBase = this.targetPlayer.GetComponent<BBBasePlayerController>();
     this.focusArea = new FocusArea(this.targetController.boxCollider.bounds, this.focusDimensions);
 }
Beispiel #5
0
    void Start()
    {
        target    = GameObject.Find("Player").GetComponent <Controller2D>();
        focusArea = new FocusArea(target.collider.bounds, focusAreaSize);

        foreach (Vector3 boundary in localBoundaries)
        {
            globalBoundaries.Add(boundary);
        }

        for (int i = 0; i < localBoundaries.Count; i++)
        {
            globalBoundaries[i] = localBoundaries[i] + transform.position;
        }
    }
        public ActionResult New(EditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel));
            }
            var focusArea = new FocusArea(string.Empty, ModelObjectHelpers.NotYetAssignedID, ModelObjectHelpers.NotYetAssignedID);

            viewModel.UpdateModel(focusArea);
            HttpRequestStorage.DatabaseEntities.FocusAreas.Add(focusArea);
            HttpRequestStorage.DatabaseEntities.SaveChanges();
            SetMessageForDisplay($"{FieldDefinition.FocusArea.GetFieldDefinitionLabel()} {focusArea.GetDisplayNameAsUrl()} successfully created.");

            return(new ModalDialogFormJsonResult());
        }
Beispiel #7
0
    void Start()
    {
        target    = FindObjectOfType <Player> ();
        focusArea = new FocusArea(target.controller.boxcollider.bounds, focusAreaSize);

        if (Bounds == null)
        {
            Debug.LogError("Add the Bounds object (BoxCollider2D) to limit the camera", gameObject);
            return;
        }

        _min        = Bounds.bounds.min;
        _max        = Bounds.bounds.max;
        isFollowing = true;
    }
    void Start()
    {
        /* Get Player Object. */
        GameObject playerObj = GameObject.Find("Player");

        if (playerObj != null)
        {
            //player = playerObj.GetComponent<CharacterBase>();
            //player = Player.Instance.gameObject.GetComponent<PBaseMovement>();
            player = playerObj.GetComponent <PBaseMovement>();
        }
        //player = Player.Instance.gameObject.GetComponent<PBaseMovement>();


        focusArea = new FocusArea(player.collider.bounds, focusAreaSize);
    }
Beispiel #9
0
    void Start()
    {
        target = WLD_GameController.player.GetComponent <Collider>();
        player = WLD_GameController.player;

        focusArea          = new FocusArea(target.bounds, focusAreaSize);
        originalVertOffset = verticalOffset;
        currentLevel       = WLD_GameController.activeLevel.LevelName;
        previousLevel      = currentLevel;

        if (zCamDist == 0)
        {
            zCamDist = this.transform.position.z;
        }

        inTeleporter = false;
    }
    PlayerControl player;  //Nosso player está sendo estaciada nessa classe, para que podemos acessar.

    // Use this for initialization
    void Start()
    {
        isFollowing = true;

        //Classes sendo estanciadas.
        focusArea = new FocusArea(target.GetComponent <BoxCollider2D>().bounds, focusAreaSize);
        player    = target.GetComponent <PlayerControl>();
        theCamera = GetComponent <Camera>();

        /* minBounds = boundBox.bounds.min;
         * maxBounds = boundBox.bounds.max;*/

        /*halfHeight = theCamera.orthographicSize;
         * halfWidth = halfHeight * Screen.width / Screen.height;*/

        theCamera.transform.Translate(player.transform.position);
    }
Beispiel #11
0
    void Start()
    {
        if (target == null)
        {
            GameObject follow = GameObject.FindWithTag("Player");
            if (follow == null)
            {
                Debug.LogError("CameraFollow: No Player found in current Scene.", follow);
            }
            else
            {
                target = follow.GetComponent <Controller2D>();
            }
        }

        focusArea = new FocusArea(target.boxCollider2D.bounds, focusAreaSize);
    }
 void Start()
 {
     //Kyle Code
     //looks at all kids and sets the camera to follow the local instance
     PhotonView[] kids = FindObjectsOfType <PhotonView>();
     foreach (PhotonView kid in kids)
     {
         if (kid.IsMine)
         {
             target = kid.gameObject.GetComponent <Controller2D>();
             Debug.Log("Found a kid for the camera to follow");
             return;
         }
     }
     Debug.LogError("No local player instance found, that shouldn't have happened :(");
     //end Kyle code
     focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
 }
    private void Start()
    {
        height = Camera.main.orthographicSize * 2;
        width  = height * Camera.main.aspect;

        focusArea = new FocusArea(target.boxCollider.bounds, focusAreaSize);
        spawnPos  = transform.position;

        xPosLimits = new Vector2(
            cameraBoundingWalls.transform.Find("lwall").transform.position.x,
            cameraBoundingWalls.transform.Find("rwall").transform.position.x
            );

        yPosLimits = new Vector2(
            cameraBoundingWalls.transform.Find("floor").transform.position.y,
            cameraBoundingWalls.transform.Find("ceiling").transform.position.y
            );

        startColor = Camera.main.backgroundColor;
    }
    public void Init()
    {
        currentLookAheadX   = 0;
        targetLookAheadX    = 0;
        lookAheadDirX       = 0;
        smoothLookVelocityX = 0;

        smoothVelocityY  = 0;
        lookAheadStopped = false;

        //transform.position = target.transform.position;
        focusArea             = new FocusArea(target.myCollider.bounds, focusAreaSize);
        verticalSmoothTimeTmp = verticalSmoothTime;
        scrollingBackgrounds  = FindObjectsOfType <ScrollingBackground>();
        // Save x/y offsets for later camera movements
        Vector2 focusPosition = focusArea.centre + Vector2.up * verticalOffset + Vector2.right * horizontalOffset;

        postInitOffsets.x = focusPosition.x - target.transform.position.x;
        postInitOffsets.y = focusPosition.y - target.transform.position.y;
    }
Beispiel #15
0
    void LateUpdate()
    {
        if (target == null)
        {
            target    = GameObject.FindWithTag("Player").GetComponent <Controller2D>();
            focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
            return;
        }

        focusArea.Update(target.collider.bounds);

        Vector2 focusPosition = focusArea.center + Vector2.up * verticalOffset;

        if (focusArea.velocity.x != 0)
        {
            lookAheadDirX = Mathf.Sign(focusArea.velocity.x);
            if (Mathf.Sign(controllerData.inputDirection.x) == Mathf.Sign(focusArea.velocity.x) && controllerData.inputDirection.x != 0)
            {
                lookAheadStopped = false;
                targetLookAheadX = lookAheadDirX * lookAheadDstX;
            }
            else
            {
                if (lookAheadStopped == false)
                {
                    lookAheadStopped = true;
                    targetLookAheadX = currentLookAheadX + (lookAheadDirX * lookAheadDstX - currentLookAheadX) / 4f;
                }
            }
        }

        currentLookAheadX = Mathf.SmoothDamp(currentLookAheadX, targetLookAheadX, ref smoothLookVelocityX, lookSmoothTimeX);

        focusPosition += Vector2.right * currentLookAheadX;
        Vector3 newPosition = (Vector3)focusPosition + Vector3.forward * -10;

        newPosition.x = Mathf.Clamp(newPosition.x, this.clampCameraX.x, this.clampCameraX.y);
        newPosition.y = Mathf.Clamp(newPosition.y, this.clampCameraY.x, this.clampCameraY.y);

        transform.position = newPosition;
    }
Beispiel #16
0
        private static MapInitJson GetMapInitJsonWithProjects(FocusArea focusArea, out bool hasSpatialData, Person currentPerson)
        {
            hasSpatialData = false;

            var layers = new List <LayerGeoJson>();

            if (focusArea.FocusAreaLocation != null)
            {
                hasSpatialData = true;
                layers.Add(new LayerGeoJson($"{FieldDefinition.FocusArea.GetFieldDefinitionLabel()} Location",
                                            focusArea.FocusAreaLocationToFeatureCollection(), "blue", 1,
                                            LayerInitialVisibility.Show));
            }

            var allActiveProjectsAndProposals = focusArea.GetAllActiveProjects(currentPerson).Where(x => x.ProjectStage.ShouldShowOnMap()).ToList();

            var projectsAsSimpleLocations = allActiveProjectsAndProposals.Where(x => x.ProjectLocationSimpleType != ProjectLocationSimpleType.None).ToList();
            var projectSimpleLocationsFeatureCollection = new FeatureCollection();

            var allProjectGrantAllocationExpenditures =
                HttpRequestStorage.DatabaseEntities.ProjectGrantAllocationExpenditures.ToList();
            var projectGrantAllocationExpenditureDict = allProjectGrantAllocationExpenditures.GroupBy(x => x.ProjectID).ToDictionary(x => x.Key, y => y.ToList());

            projectSimpleLocationsFeatureCollection.Features.AddRange(projectsAsSimpleLocations.Select(x =>
            {
                var feature = x.MakePointFeatureWithRelevantProperties(x.ProjectLocationPoint, true, true, FieldDefinition.Organization.GetFieldDefinitionLabel(), FieldDefinition.Organization.GetFieldDefinitionLabelPluralized(), projectGrantAllocationExpenditureDict);
                feature.Properties["FeatureColor"] = "#99b3ff";
                return(feature);
            }).ToList());

            if (projectSimpleLocationsFeatureCollection.Features.Any())
            {
                hasSpatialData = true;
                layers.Add(new LayerGeoJson("Projects", projectSimpleLocationsFeatureCollection, "yellow", 1, LayerInitialVisibility.Show));
            }

            var boundingBox = BoundingBox.MakeBoundingBoxFromLayerGeoJsonList(layers);

            return(new MapInitJson($"focusArea_{focusArea.FocusAreaID}_Map", 10, layers, boundingBox));
        }
Beispiel #17
0
    void LateUpdate()
    {
        FocusArea.Update(Target.Collider2D.bounds);

        Vector2 focusPosition = FocusArea.Centre + Vector2.up * VerticalOffset;

        if (FocusArea.Velocity.x != 0)
        {
            LookAheadDirX = Mathf.Sign(FocusArea.Velocity.x);
            if (Mathf.Sign(Target.PlayerInput.x) == Mathf.Sign(FocusArea.Velocity.x) && Target.PlayerInput.x != 0)
            {
                LookAheadStopped = false;
                TargetLookAheadX = LookAheadDirX * LookAheadDstX;
            }
            else
            {
                // If the player stopped moving in the X axis, the camera will stop the look ahead feature.
                if (!LookAheadStopped)
                {
                    LookAheadStopped = true;
                    TargetLookAheadX = CurrentLookAheadX + (LookAheadDirX * LookAheadDstX - CurrentLookAheadX) / 4f;
                }
            }
        }

        // Temp variable to store the SmoothDamp float, we assign it to the desired variable in the next few lines.
        float tempSLVX = SmoothLookVelocityX;

        CurrentLookAheadX   = Mathf.SmoothDamp(CurrentLookAheadX, TargetLookAheadX, ref tempSLVX, LookSmoothTimeX);
        SmoothLookVelocityX = tempSLVX;

        // Temp variable to store the SmoothDamp float, we assign it to the desired variable in the next few lines.
        float tempSVY = SmoothVelocityY;

        focusPosition.y = Mathf.SmoothDamp(transform.position.y, focusPosition.y, ref tempSVY, VerticalSmoothTime);
        SmoothVelocityY = tempSVY;

        focusPosition     += Vector2.right * CurrentLookAheadX;
        transform.position = (Vector3)focusPosition + Vector3.forward * -10;
    }
Beispiel #18
0
        void Start()
        {
            float focusAreaHalfWidth = focusAreaSize.x * 0.5f;

            _camera = GetComponent <Camera>();
            _camera.orthographicSize = (stopDistance + focusAreaHalfWidth) * _camera.scaledPixelHeight / _camera.scaledPixelWidth;


            float   cameraHalfWidth   = _camera.orthographicSize * _camera.aspect;
            Bounds  battleFieldBounds = _battleFieldModel.Bounds;
            float   maxWidth          = battleFieldBounds.size.x - 2 * (cameraHalfWidth + lookAheadDistance - focusAreaHalfWidth - cameraMargin);
            float   maxBoundsCenterY  = battleFieldBounds.max.y + maxWidth * 0.5f;
            Vector2 maxBoundsCenter   = new Vector2(battleFieldBounds.center.x, maxBoundsCenterY);
            Vector2 maxBoundsSize     = new Vector2(maxWidth, maxWidth);

            _focusArea = new FocusArea(
                focusAreaSize,
                new Bounds(maxBoundsCenter, maxBoundsSize),
                _hero.Bounds);

            _lookAheadStopped = true;
        }
Beispiel #19
0
        public async Task <ActionResult> Create([Bind(Include = "ID,FocusAreaName,FocusAreaDesc,OrganizationID,CreatedDate,isActive,TimeStamp,UserId")] FocusArea focusArea)
        {
            #region USERVALIDATION
            token = (string)(Session["accessToken"]);
            string userID = (string)(Session["UserID"]);
            #endregion
            if (ModelState.IsValid)
            {
                focusArea.CreatedDate = DateTime.Now;
                focusArea.UserId      = userID;
                focusArea.TimeStamp   = DateTime.Now;

                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseurl);
                    client.DefaultRequestHeaders.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    HttpResponseMessage Res = await client.PostAsJsonAsync("api/FocusAreas", focusArea);

                    if (Res.IsSuccessStatusCode)
                    {
                        this.AddNotification("Focus Area created successfully", NotificationType.SUCCESS);
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        this.AddNotification("Focus Area cannot be created at this time. Please contact Administrator" + Res, NotificationType.ERROR);
                        return(View());
                    }
                }
            }
            ViewBag.OrganizationID = await OrganizationSelectListByModel(token, focusArea.OrganizationID);

            return(View(focusArea));
        }
Beispiel #20
0
        public async Task <ActionResult> Edit(int?id)
        {
            #region USERVALIDATION
            token = (string)(Session["accessToken"]);
            string userID = (string)(Session["UserID"]);
            #endregion
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            List <FocusArea> focusArea   = new List <FocusArea>();
            FocusArea        myFocusArea = new FocusArea();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                HttpResponseMessage Res = await client.GetAsync($"api/FocusAreas/{id}");

                if (Res.IsSuccessStatusCode)
                {
                    var focusAreaResponse = Res.Content.ReadAsStringAsync().Result;
                    myFocusArea = JsonConvert.DeserializeObject <FocusArea>(focusAreaResponse);
                }
                else
                {
                    this.AddNotification("Unable to display Focus Area information,please contact Administrator" + Res, NotificationType.ERROR);
                    return(View());
                }
            }
            ViewBag.OrganizationID = await OrganizationSelectListByModel(token, myFocusArea.OrganizationID);

            return(View(myFocusArea));
        }
Beispiel #21
0
 private void Start()
 {
     focusArea = new FocusArea(targetBounds, focusAreaSize);
 }
 public bool SetFocus()
 {
     ContentFocusedCommand?.Execute(this);
     return(FocusArea.Focus());
 }
 void Start()
 {
     zValue = transform.position.z;
     focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
 }
 // Use this for initialization
 void Start()
 {
     focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
 }
Beispiel #25
0
 void Start()
 {
     Cursor.visible = false;
     focusArea      = new FocusArea(target.collider.bounds, focusAreaSize);
 }
Beispiel #26
0
 // Use this for initialization
 void Start()
 {
     player    = GameObject.FindGameObjectWithTag("Player");
     cam       = GetComponent <Camera> ();
     focusArea = new FocusArea(player.GetComponent <Collider>().bounds, focusAreaSize);
 }
	void Start(){
		focusArea = new FocusArea (target, focusAreaSize);
	}
Beispiel #28
0
 void Start()
 {
     // Update the focusArea variable with the target's bounds and focusAreaSize.
     focusArea = new FocusArea(target.boxCollider.bounds, focusAreaSize);
 }
Beispiel #29
0
 void Start()
 {
     focusArea = new FocusArea (PlayerController.current.collider.bounds, focusAreaSize);
 }
    void Start()
    {
        targetBoxCollider = target.GetComponent<BoxCollider2D>();

        focusArea = new FocusArea (targetBoxCollider.bounds, focusAreaSize);
    }
Beispiel #31
0
 void Start()
 {
     _focusArea = new FocusArea(Target.Collider.bounds, FocusAreaSize);
 }
Beispiel #32
0
 public void SetTarget(Transform controller)
 {
     //Ошибка, когда спаунится игрок камера тут же прыгает на него. обходя ограничение по лимиту.
     target    = controller.GetComponent <BoxCollider2D>();
     focusArea = new FocusArea(target.bounds, focusAreaSize, limit);
 }
Beispiel #33
0
	// Use this for initialization
	void Start () {
		focusArea = new FocusArea (BoundsColliders(player), focusAreaSize);
	}
    void Start()
    {
        VerticalOffset = 1;

        LookAheadDstX = 4;

        LookSmoothTimeX = 0.5f;
        VerticalSmoothTime = 0.2f;

        FocusAreaSize = new Vector2(3,5);

        FocusArea = new FocusArea(Target.Collider2D.bounds, FocusAreaSize);
    }
Beispiel #35
0
 void Start()
 {
     focusArea    = new FocusArea(target.collider.bounds, focusAreaSize);
     alucard      = GameObject.Find("alucard");
     InputManager = alucard.GetComponent <Player.InputManager>();
 }
Beispiel #36
0
 public void Init()
 {
     targetCollider  = GameObject.FindWithTag("Player").GetComponent <Collider2D>();
     targetRigidBody = targetCollider.GetComponent <Rigidbody2D>();
     focusArea       = new FocusArea(targetCollider.GetComponent <Collider2D>().bounds, focusAreaSize);
 }
 void Start() {
   focusArea = new FocusArea (target.pc2d.box.bounds, focusAreaSize);
 }
Beispiel #38
0
 private void Start()
 {
     m_FocusArea       = new FocusArea(MainTarget.Collider.bounds, m_FocusAreaSize);
     m_TargetPositionX = MainTarget.transform.position.x;
 }
Beispiel #39
0
 void Start()
 {
     focusArea = new FocusArea(target.GetComponent<Collider2D>().bounds, focusAreaSize);
 }
Beispiel #40
0
 void Start()
 {
     focusArea = new FocusArea(target.p_pCalculator.GetBounds(), focusAreaSize);
 }
Beispiel #41
0
 void Start()
 {
     cameraFocusArea = new FocusArea(controller.collider.bounds, cameraFocusAreaSize);
 }
Beispiel #42
0
 void Start()
 {
     m_focusArea = new FocusArea(m_playerCol.bounds, m_focusAreaSize);
 }
Beispiel #43
0
 // Use this for initialization
 void Awake()
 {
     focusArea = new FocusArea (CharController.Instance.transform.GetComponent<CharacterController>().bounds, focusAreaSize);
     cameraEvent = 0;
     playerFocused = true;
     targetFocused = false;
     distanceAway = zoomDistance;
 }
Beispiel #44
0
    // Unity
    // =====================================================================

    private void Start()
    {
        _focusArea = new FocusArea(target.collider.bounds, focusAreaSize);
    }
Beispiel #45
0
	public void LateStart(){
		cam = GetComponent<Camera>();
		focusArea = new FocusArea (targets,ref focusAreaSize);
	}
Beispiel #46
0
 void Start()
 {
     focusArea = new FocusArea(target.colliders.bounds, focusAreaSize);
 }
Beispiel #47
0
 // Use this for initialization
 void Start()
 {
     focusArea = new FocusArea (CharController.Instance.transform.GetComponent<CharacterController>().bounds, focusAreaSize);
     cameraEvent = 0;
     playerFocused = true;
 }
Beispiel #48
0
 void Start()
 {
     focusArea = new FocusArea(target.GetComponent <BoxCollider2D>().bounds, focusAreaSize);
 }
	public void UpdateTarget () {
        target = GameObject.FindGameObjectWithTag("Player").GetComponent<Controller2D>();
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
        parallaxScrolling = GameObject.FindObjectOfType<ParallaxScrolling>().GetComponent<ParallaxScrolling>();
        focusArea = new FocusArea(target.boxCollider.bounds, focusAreaSize);
    }