예제 #1
0
    public void FillAttachmentPoint(Side s)
    {
        AttachmentPoints at = GetPointFromSide(s);

        if (at != null)
        {
            at.Empty = false;
        }
    }
예제 #2
0
    public static string GetBoneForPart(AttachmentPoints part)
    {
        switch (part)
        {
        case AttachmentPoints.left_hand:
            return("Attach_Lhand");

        case AttachmentPoints.right_hand:
            return("Attach_Rhand");
        }
        return("");
    }
예제 #3
0
        /// <exclude />
        public void LogTree()
        {
            Log.LogVerbose(LogTitle, string.Format("{0} - Tree informations:", this.TreeId));

            Log.LogVerbose(LogTitle, "Attachment points:");
            AttachmentPoints.ForEach(a => a.Log(LogTitle, indention: "  "));

            Log.LogVerbose(LogTitle, "Possible attachment points:");
            PossibleAttachmentPoints.ForEach(a => a.Log(LogTitle, indention: "  "));

            Log.LogVerbose(LogTitle, "Tree nodes:");
            this.RootTreeNode.LogTree(1);
        }
예제 #4
0
    public float Distance(AttachmentPoints point)
    {
        int index = Points.IndexOf(point);

        if (index >= 0 && index <= Points.Count)
        {
            AttachmentPoints p = Points[index];
            if (p != null)
            {
                return(Vector3.Distance(middlePoint.position, p.transform.position));
            }
        }
        return(0);
    }
예제 #5
0
    public static void AttachToBone(GameObject target_rig, GameObject part, AttachmentPoints point)
    {
        string    bone_name = GetBoneForPart(point);
        Transform bone      = GetBone(target_rig, bone_name);

        if (bone == null)
        {
            Debug.LogWarning("COULD NOT FIND BONE " + bone_name);
        }
        //  GameObject part_instance = Instantiate(part, bone.transform.position, bone.transform.rotation) as GameObject;
        part.transform.rotation = bone.transform.rotation;
        part.transform.position = bone.transform.position;
        part.transform.SetParent(bone);
    }
예제 #6
0
 public void ReadChildData(BinaryReader reader)
 {
     _redFlagShader.ReadString(reader);
     _physics.ReadString(reader);
     _blueFlagShader.ReadString(reader);
     for (int x = 0; x < _attachmentPoints.Count; x++)
     {
         AttachmentPoints.AddNew();
         AttachmentPoints[x].Read(reader);
     }
     for (int x = 0; x < _attachmentPoints.Count; x++)
     {
         AttachmentPoints[x].ReadChildData(reader);
     }
 }
예제 #7
0
        public BlockPrefabBuilder SetSize(Vector3I size, AttachmentPoints points = AttachmentPoints.Bottom)
        {
            ThrowIfFinished();
            List <IntVector3> cells = new List <IntVector3>();
            List <Vector3>    aps   = new List <Vector3>();

            for (int x = 0; x < size.x; x++)
            {
                for (int y = 0; y < size.y; y++)
                {
                    for (int z = 0; z < size.z; z++)
                    {
                        cells.Add(new Vector3(x, y, z));
                        if (y == 0)
                        {
                            aps.Add(new Vector3(x, -0.5f, z));
                        }
                        if (points == AttachmentPoints.All)
                        {
                            if (x == 0)
                            {
                                aps.Add(new Vector3(-0.5f, y, z));
                            }
                            if (x == size.x - 1)
                            {
                                aps.Add(new Vector3(x + 0.5f, y, z));
                            }
                            if (y == size.y - 1)
                            {
                                aps.Add(new Vector3(x, y + 0.5f, z));
                            }
                            if (z == 0)
                            {
                                aps.Add(new Vector3(x, y, -0.5f));
                            }
                            if (z == size.z - 1)
                            {
                                aps.Add(new Vector3(x, y, z + 0.5f));
                            }
                        }
                    }
                }
            }
            _block.filledCells  = cells.ToArray();
            _block.attachPoints = aps.ToArray();
            return(this);
        }
예제 #8
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                _redFlagShader.ReadString(reader);
                _physics.ReadString(reader);
                _blueFlagShader.ReadString(reader);
                for (x = 0; (x < _attachmentPoints.Count); x = (x + 1))
                {
                    AttachmentPoints.Add(new FlagAttachmentPointBlock());
                    AttachmentPoints[x].Read(reader);
                }
                for (x = 0; (x < _attachmentPoints.Count); x = (x + 1))
                {
                    AttachmentPoints[x].ReadChildData(reader);
                }
            }