Ejemplo n.º 1
0
        //Клонинг конструктор когато стойността е различна от Null
        public Step Clone()
        {
            Step newStep = new Step();

            newStep.Highlight = Highlight;
            newStep.Message   = Message;
            newStep.Command   = Command;


            if (AttachNames != null)
            {
                newStep.AttachNames = AttachNames.ToList <string>();
            }
            if (AttachTo != null)
            {
                newStep.AttachTo = AttachTo.ToList <int>();
            }
            if (Rows != null)
            {
                newStep.Rows = Rows.ToList <int>();
            }
            if (VariableNames != null)
            {
                newStep.VariableNames = VariableNames.ToList <string>();
            }
            if (VariableIndexes != null)
            {
                newStep.VariableIndexes = VariableIndexes.ToList <int>();
            }
            if (Values != null)
            {
                newStep.Values = Values.ToList <string>();
            }
            if (HighlightenedBlockIndexes != null)
            {
                newStep.HighlightenedBlockIndexes = HighlightenedBlockIndexes.ToList <int>();
            }
            if (HighlightenedLabelIndexes != null)
            {
                newStep.HighlightenedLabelIndexes = HighlightenedLabelIndexes.ToList <int>();
            }
            if (HighlightedTableIndexes != null)
            {
                newStep.HighlightedTableIndexes = HighlightedTableIndexes.ToList <int>();
            }
            newStep.Swit                  = Swit;
            newStep.Delimiter             = Delimiter;
            newStep.UsedelimForUpdateInit = UsedelimForUpdateInit;
            return(newStep);
        }
Ejemplo n.º 2
0
    private void PlaceFootprint()
    {
        Vector3    footPosition = transform.position + (rightFootLast? transform.right * Radius / 2f : -transform.right * Radius / 2f);
        Ray        ray          = new Ray(footPosition, Vector3.down);
        RaycastHit rayHit;

        //print("placing footprint");
        Debug.DrawRay(footPosition, Vector3.down, Color.green, 5.0F);
        if (Physics.Raycast(ray, out rayHit, controller.height, mask))
        {
            Vector3    position = rayHit.point + rayHit.normal * 0.001f;
            GameObject prefab   = NextPrefab();

            previousFootprint = currentFootprint;

            // Spawn
            currentFootprint = Instantiate(prefab).GetComponent <FootprintList>();
            currentFootprint.transform.position = position;
            currentFootprint.transform.rotation = transform.rotation;
            currentFootprint.transform.parent   = footPrintParent.transform;
            currentFootprint.GetComponent <FootprintDecay>().SetLifeTime(FootprintLifetime);

            //print("pos " + currentFootprint.transform.position);

            if (rayHit.collider.gameObject.layer == dynamicObjectLayer)
            {
                // attach footprint to dynamic objects
                AttachTo a = currentFootprint.gameObject.AddComponent <AttachTo>();
                a.To            = rayHit.collider.gameObject;
                a.UseWorldSpace = true;
            }

            // Set Linked List
            if (previousFootprint != null)
            {
                previousFootprint.setNext(currentFootprint);
            }
            currentFootprint.setPrevious(previousFootprint);

            // Prep for next footprint
            distanceTraveled = 0f;
            rightFootLast    = !rightFootLast;

            if (gameObject.CompareTag("Player"))
            {
                //print("attempting to add footprint to dictionary");
                GameManager.Instance.AddFootprint(currentFootprint, footPosition);
            }
        }
    }
Ejemplo n.º 3
0
		public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
		{
			ctx.loadReference(this);
			type = (AttachTo)reader.ReadInt32();
			attData = reader.ReadInt32();

			// in format revision 28 'percents' changed from Rectangle to RectangleF
			if (ctx.FileVersion < 28)
			{
				Rectangle r = ctx.loadRect();
				percents = RectangleF.FromLTRB(r.Left, r.Top, r.Right, r.Bottom);
			}
			else
			{
				percents = ctx.loadRectF();
			}
		}
Ejemplo n.º 4
0
        public virtual void loadFrom(BinaryReader reader, PersistContext ctx)
        {
            ctx.loadReference(this);
            type    = (AttachTo)reader.ReadInt32();
            attData = reader.ReadInt32();

            // in format revision 28 'percents' changed from Rectangle to RectangleF
            if (ctx.FileVersion < 28)
            {
                Rectangle r = ctx.loadRect();
                percents = RectangleF.FromLTRB(r.Left, r.Top, r.Right, r.Bottom);
            }
            else
            {
                percents = ctx.loadRectF();
            }
        }
Ejemplo n.º 5
0
    void DrawChalk()
    {
        Transform pointer;

        if (GameManager.Instance.PlayersVRType == VirtualRealityType.None)
        {
            pointer = cam.transform;
        }
        else
        {
            pointer = DrawingHand.transform;
        }

        Vector3    dir = pointer.transform.rotation * Vector3.forward;
        Ray        ray = new Ray(pointer.transform.position, dir);
        RaycastHit rayHit;

        if (Physics.Raycast(ray, out rayHit, DrawingDistance, drawingLayerMask)) // if object to draw on
        {
            // if first segment or different face normals or moved onto a dynamic object
            if (!drawing || rayHit.normal != chalkFaceNormal || (lastObjectDrawnOn != rayHit.collider.gameObject && rayHit.collider.gameObject.layer == dynamicObjectLayer))
            {
                drawing = true;
                StartNewMark();
                currentMark.transform.rotation = Quaternion.LookRotation(-rayHit.normal);
                chalkFaceNormal   = rayHit.normal;
                lastObjectDrawnOn = rayHit.collider.gameObject;
                if (rayHit.collider.gameObject.layer == dynamicObjectLayer)
                {
                    AttachTo a = currentMark.gameObject.AddComponent <AttachTo>();
                    a.To = rayHit.collider.gameObject;
                }
            }

            // prevent z fighting
            Vector3 offset   = rayHit.normal * 0.002f;
            Vector3 position = (Vector3)(currentMark.transform.worldToLocalMatrix * (rayHit.point + offset)) - currentMark.transform.position;

            // Add point to the line render
            currentMark.positionCount++;
            currentMark.SetPosition(currentMark.positionCount - 1, position);

            // Track distance drawn
            if (currentMark.positionCount > 1)
            {
                DistanceDrawn += Vector3.Distance(lastDrawnPoint, rayHit.point);
            }
            lastDrawnPoint = rayHit.point;

            // Update Inventory
            if (DistanceDrawn > PlayerInventory.DistancePerCharge)
            {
                PlayerInventory.Used(ItemType.Chalk);
                DistanceDrawn -= PlayerInventory.DistancePerCharge;
            }
        }
        else
        {
            drawing = false;
        }
    }