Example #1
0
        public void Send(ref MinecraftClient client, GameStream stream)
        {
            int data = 0;

            switch (_entity.Identifier.Name)
            {
            case "item_frame":
                ItemFrame iFrame = (ItemFrame)_entity;
                data = iFrame.Rotation;
                break;

            case "falling_block":
                /*FallingBlock fBlock = (FallingBlock) _entity;
                 * data = fBlock.World.GetAtPosition(fBlock.SpawnPosition).State*/
                break;

            case "fishing_hook":
                FishingHook fHook = (FishingHook)_entity;
                data = fHook.HookedId;
                break;
            }

            Protocol.Send(ref client, stream, Packet,
                          _entity.Id, _entity.UniqueId.ToString(),
                          _entity.Type,
                          _entity.Position.X, _entity.Position.Y, _entity.Position.Z,
                          _entity.Position.Pitch, _entity.Position.Yaw,
                          data,
                          (short)_entity.Velocity.X,
                          (short)_entity.Velocity.Y,
                          (short)_entity.Velocity.Z);
        }
Example #2
0
                public LineManager(Rod parent, Rigidbody rb, ref LineRenderer line, int num)
                {
                    m_parent = parent;

                    m_num = num;

                    m_lineRenderer = line;
                    m_lineRenderer.positionCount = num;

                    //CreateLine(obj);

                    FishingHook = new GameObject().AddComponent <Rigidbody>();
                    FishingHook.gameObject.name = "FishingHook";
                    FishingHook.mass            = 2f;
                    FishingHook.drag            = 1f;
                    FishingHook.angularDrag     = 0f;

                    FishingHookInstance = FishingHook.gameObject.AddComponent <FishingHook>();
                    FishingHookInstance.GetParentRod = m_parent;

                    SpringJoint sj = rb.gameObject.AddComponent <SpringJoint>();

                    Spring = sj;

                    sj.anchor = Vector3.zero;
                    sj.autoConfigureConnectedAnchor = false;
                    sj.connectedAnchor = Vector3.zero;

                    sj.spring      = 1000000f;
                    sj.damper      = 100f;
                    sj.maxDistance = 0f;

                    sj.connectedBody = FishingHook;
                }
Example #3
0
                private IEnumerator C_JoinHook(FishingHook hook)
                {
                    hook.GetFish = this;

                    m_parentHook = hook;

                    yield return(null);

                    if (hook.GetRigidbody)
                    {
                        Vector3 p  = transform.position;
                        Vector3 hp = hook.transform.position;
                        Vector3 mp = transform.position - Mouth.position;

                        //Rigidbody rb = Mouth.gameObject.GetComponent<Rigidbody>();
                        //if(!rb)
                        //rb = Mouth.gameObject.AddComponent<Rigidbody>();
                        //rb.isKinematic = true;

                        transform.position = hp + mp;

                        m_hookFixedJoint = gameObject.AddComponent <FixedJoint>();
                        m_hookFixedJoint.connectedBody = hook.GetRigidbody;
                    }
                }
Example #4
0
 public void SetHook(FishingHook hook)
 {
     this.m_Hook           = hook;
     this.m_LastDistToHook = float.MaxValue;
     this.SetState(this.m_Hook ? Fish.State.SwimToHook : Fish.State.Swim);
 }
Example #5
0
 public void SetHook(FishingHook hook)
 {
     this.m_Hook = hook;
     this.SetState(Fish.State.SwimToHook);
 }
Example #6
0
 public void JoinHook(FishingHook hook)
 {
     StartCoroutine(C_JoinHook(hook));
 }