Example #1
0
        void Start()
        {
            var availableColliders = PlayerTransform.GetTransform().gameObject.GetComponentsInChildren <BoxCollider2D>();

            foreach (var collider in availableColliders)
            {
                if (collider.tag == CharacterColliderTag)
                {
                    this.collider = collider;
                    break;
                }
            }

            castRays = CastRays.GetInstance();
        }
Example #2
0
        public void UseSkill(Vector2 dirVector, Teams teamTag, Vector2 playerSpeed)
        {
            //dirVector = GetTeleportCoords(dirVector);

            var bodyColliderBounds = collider.bounds;
            var rectangleShape     = new RectangleF(bodyColliderBounds.center.x, bodyColliderBounds.center.y, bodyColliderBounds.size.x - skinWidth.x, bodyColliderBounds.size.y - skinWidth.y);

            if ((GetVectorSquareCoords(Camera.main.ScreenToWorldPoint(playerSpeed)))
                - GetVectorSquareCoords(PlayerTransform.GetTransform().position) <= SkillValue * SkillValue)
            {
                Vector2 movementVector;
                List <LaserPartData> placeholder;   //For now, simply stores all the chunks of the path.
                (placeholder, movementVector) = castRays.ProjectRectangle(rectangleShape, dirVector, TeleportRange, checkedLayers);

                Vector3 position = PlayerTransform.GetTransform().position + new Vector3(movementVector.x, movementVector.y, 0);
                PlayerTransform.GetTransform().position = position;
            }
            StartSkillCD();
        }