Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ibrahim

Pages: [1]
1
TNet 3 Support / Re: ERROR Object not added to TNManager
« on: February 16, 2016, 08:50:12 AM »
Hey again sir im having a new error i hope this be last check in the screenshoots please ...
i already used TNManager.ADDRCCs<cannon>(); in script awake but still giving this error

2
TNet 3 Support / Re: ERROR Object not added to TNManager
« on: February 15, 2016, 04:06:06 PM »
Thanks you for your time sir but seems she giving me error again but by the way thanks for your time and sory i sesturbe you ....

3
TNet 3 Support / Re: ERROR Object not added to TNManager
« on: February 15, 2016, 02:42:14 PM »
Can you help me please with this im trying but awsly fail when make it throw please

4
TNet 3 Support / Re: ERROR Object not added to TNManager
« on: February 15, 2016, 02:28:27 PM »
Can you give me a way how can i make it right i already fixed it with TNManager.create() but she dont have power of throw in it stay in same place :(

5
TNet 3 Support / ERROR Object not added to TNManager
« on: February 15, 2016, 12:51:03 PM »
Hello Again!
i tryed to fix my game client and now giving error object not addet do TNManager did you forgot my script its

  1. [TNet.RCC(10)]
  2.         void Update()
  3.         {
  4.                 float time = Time.time;
  5.  
  6.                 // We're ready to fire -- fire the cannon
  7.                 if (mFireTime != 0f && mFireTime <= time)
  8.                 {
  9.                         // Recharge time varies from 80% to 120% of the intended duration just to add variety
  10.                         mRechargeTime = time + rechargeTime * Mathf.Lerp(0.8f, 1.2f, Random.value);
  11.                         mFireTime = 0f;
  12.  
  13.                         // Create the cannon ball
  14.                         if (cannonballPrefab != null)
  15.                         {
  16.                                 // Instantiate the prefab
  17.                                 GameObject go = TNManager.Instantiate(cannonballPrefab, mTrans.position, mTrans.rotation) as GameObject;
  18.  
  19.  
  20.  
  21.                                 if (mColliders != null)
  22.                                 {
  23.                                         Collider col = go.GetComponent<Collider>();
  24.  
  25.                                         if (col != null)
  26.                                         {
  27.                                                 foreach (Collider c in mColliders)
  28.                                                 {
  29.                                                         Physics.IgnoreCollision(c, col);
  30.                                                 }
  31.                                         }
  32.                                 }
  33.  
  34.                                 // It's usually a good idea to know who fired the cannon ball
  35.                                 Cannonball cb = go.GetComponent<Cannonball>();
  36.                                 if (cb != null) cb.owner = mStats.gameObject;
  37.  
  38.                                 // Rigidbody is generally expected to be present
  39.                                 Rigidbody rb = go.GetComponent<Rigidbody>();
  40.  
  41.                                 if (rb != null)
  42.                                 {
  43.                                         Vector2 deviation = Vector2.zero;
  44.  
  45.                                         // Deviate the aim a little
  46.                                         if (maxAimDeviationAngle > 0f)
  47.                                         {
  48.                                                 deviation = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f));
  49.                                                 deviation.Normalize();
  50.                                                 deviation *= maxAimDeviationAngle;
  51.                                         }
  52.  
  53.                                         // Calculate the initial velocity
  54.                                         Quaternion firingDir = Quaternion.LookRotation(mFiringDir);
  55.                                         Vector3 vel = (firingDir * Quaternion.Euler(-mFiringPitch + deviation.x, deviation.y, 0f)) *
  56.                                                 Vector3.forward * initialVelocity;
  57.  
  58.                                         // NOTE: For physics-accurate results we should append the ship's velocity as well,
  59.                                         // but this makes the auto-aiming logic fail unless the ship isn't moving.
  60.                                         rb.velocity = vel;
  61.                                         TNManager.CreateEx (10,false,go);
  62.                                 }
  63.                                 else
  64.                                 {
  65.                                         Debug.LogWarning("The cannon ball is missing its rigidbody");
  66.                                 }
  67.  
  68.                         }
  69.                 }
  70.         }

and i added my object cannonball in tnmanager how can i fix this plz .. using tnet 2.1.1

6
TNet 3 Support / Re: Tnet + Standart Ship Kit Help Me
« on: February 12, 2016, 10:00:05 PM »
Modify to like what to another number or ....

7
TNet 3 Support / Re: Tnet + Standart Ship Kit Help Me
« on: February 12, 2016, 09:48:18 PM »
She is giving me and No overload from method 'Create' takes '7' arguments

8
TNet 3 Support / Re: Tnet + Standart Ship Kit Help Me
« on: February 12, 2016, 09:19:56 PM »
Sir im using the version 2.1 of TNet but im really confuse where i need to add this script you seend to me the file script to me its this down here if you can fix and send me fixed please
  1. using UnityEngine;
  2.  
  3. [AddComponentMenu("Exploration/Cannon")]
  4. public class Cannon : MonoBehaviour
  5. {
  6.         // Cannonball prefab
  7.         public GameObject cannonballPrefab;
  8.  
  9.         // Initial velocity applied to the cannon ball's rigidbody
  10.         public float initialVelocity = 15f;
  11.  
  12.         // Maximum pitch that can be applied to each shot
  13.         public float maxPitch = 25f;
  14.  
  15.         // Maximum angle at which the cannon is able to fire
  16.         public float maxYaw = 45f;
  17.  
  18.         // The firing direction will have this much deviation in degrees
  19.         public float maxAimDeviationAngle = 5f;
  20.  
  21.         // Maximum possible delay that the cannon will fire after pressing the 'fire' button
  22.         public float reactionTime = 0.2f;
  23.  
  24.         // How long it takes for the cannon to recharge
  25.         public float rechargeTime = 2f;
  26.  
  27.         Transform mTrans;
  28.         GameShip mStats;
  29.         float mFireTime = 0f;
  30.         float mRechargeTime = 0f;
  31.         Collider[] mColliders;
  32.         Vector3 mFiringDir;
  33.         float mFiringPitch = 0f;
  34.         float mMaxRange = 1f;
  35.  
  36.         /// <summary>
  37.         /// Calculated maximum range of the cannon based on max pitch and initial velocity.
  38.         /// </summary>
  39.  
  40.         public float maxRange { get { return mMaxRange; } }
  41.  
  42.         /// <summary>
  43.         /// Helper function that calculates the cannon's maximum firing range.
  44.         /// </summary>
  45.  
  46.         float CalculateMaxRange ()
  47.         {
  48.                 // Vertical velocity can be calculated using the pitch and initial full velocity:
  49.                 float velocity = Mathf.Sin(Mathf.Deg2Rad * maxPitch) * initialVelocity;
  50.  
  51.                 // This is how long it will take the fired cannon ball to reach the sea level
  52.                 float time = -velocity / (0.5f * Physics.gravity.y);
  53.  
  54.                 // Now let's calculate the distance traveled horizontally in the same amount of time
  55.                 return Mathf.Cos(Mathf.Deg2Rad * maxPitch) * initialVelocity * time;
  56.         }
  57.  
  58.         /// <summary>
  59.         /// Cache the transform and the ship controlling this cannon.
  60.         /// </summary>
  61.  
  62.         void Start ()
  63.         {
  64.                 TNManager.AddRCCs<Cannon> ();
  65.                 mTrans = transform;
  66.                 mStats = GameShip.Find(mTrans);
  67.  
  68.                 // Calculate the cannon's maximum range
  69.                 mMaxRange = CalculateMaxRange();
  70.  
  71.                 if (mStats != null)
  72.                 {
  73.                         // Ship stats found -- use it as root node
  74.                         mColliders = mStats.GetComponentsInChildren<Collider>();
  75.                 }
  76.                 else
  77.                 {
  78.                         // No ship stats present -- see if there is a rigidbody that can be used as root
  79.                         Rigidbody rb = PirateTools.GetRigidbody(mTrans);
  80.                         mColliders = (rb != null) ? rb.GetComponentsInChildren<Collider>() : GetComponentsInChildren<Collider>();
  81.                 }
  82.         }
  83.  
  84.         /// <summary>
  85.         /// Fire the cannon when ready.
  86.         /// </summary>
  87.  
  88.         void Update()
  89.         {
  90.                 float time = Time.time;
  91.  
  92.                 // We're ready to fire -- fire the cannon
  93.                 if (mFireTime != 0f && mFireTime <= time)
  94.                 {
  95.                         // Recharge time varies from 80% to 120% of the intended duration just to add variety
  96.                         mRechargeTime = time + rechargeTime * Mathf.Lerp(0.8f, 1.2f, Random.value);
  97.                         mFireTime = 0f;
  98.  
  99.                         // Create the cannon ball
  100.                         if (cannonballPrefab != null)
  101.                         {
  102.                                 // Instantiate the prefab
  103.                                 GameObject go = TNManager.Instantiate("CreateCB", "Cannonball", true, pos, rot, velocity);
  104.  
  105.  
  106.  
  107.                                 // Ensure that the newly instantiated object's collider won't collide with our colliders
  108.                                 if (mColliders != null)
  109.                                 {
  110.                                         Collider col = go.GetComponent<Collider>();
  111.  
  112.                                         if (col != null)
  113.                                         {
  114.                                                 foreach (Collider c in mColliders)
  115.                                                 {
  116.                                                         Physics.IgnoreCollision(c, col);
  117.                                                 }
  118.                                         }
  119.                                 }
  120.  
  121.                                 // It's usually a good idea to know who fired the cannon ball
  122.                                 Cannonball cb = go.GetComponent<Cannonball>();
  123.                                 if (cb != null) cb.owner = mStats.gameObject;
  124.  
  125.                                 // Rigidbody is generally expected to be present
  126.                                 Rigidbody rb = go.GetComponent<Rigidbody>();
  127.  
  128.                                 if (rb != null)
  129.                                 {
  130.                                         Vector2 deviation = Vector2.zero;
  131.  
  132.                                         // Deviate the aim a little
  133.                                         if (maxAimDeviationAngle > 0f)
  134.                                         {
  135.                                                 deviation = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f));
  136.                                                 deviation.Normalize();
  137.                                                 deviation *= maxAimDeviationAngle;
  138.                                         }
  139.  
  140.                                         // Calculate the initial velocity
  141.                                         Quaternion firingDir = Quaternion.LookRotation(mFiringDir);
  142.                                         Vector3 vel = (firingDir * Quaternion.Euler(-mFiringPitch + deviation.x, deviation.y, 0f)) *
  143.                                                 Vector3.forward * initialVelocity;
  144.  
  145.                                         // NOTE: For physics-accurate results we should append the ship's velocity as well,
  146.                                         // but this makes the auto-aiming logic fail unless the ship isn't moving.
  147.                                         rb.velocity = vel;
  148.                                 }
  149.                                 else
  150.                                 {
  151.                                         Debug.LogWarning("The cannon ball is missing its rigidbody");
  152.                                 }
  153.                         }
  154.                 }
  155.         }
  156.  
  157.         /// <summary>
  158.         /// Start the firing process.
  159.         /// </summary>
  160.  
  161.         public void Fire (Vector3 dir, float distance)
  162.         {
  163.                 float time = Time.time;
  164.  
  165.                 if (mRechargeTime < time && mFireTime == 0f)
  166.                 {
  167.                         Vector3 cannonDir = mTrans.rotation * Vector3.forward;
  168.  
  169.                         // We only want this cannon to fire if the specified direction is close enough.
  170.                         // It wouldn't make sense to fire guns that are on the opposite side of the ship.
  171.                         if (Vector3.Angle(dir, cannonDir) < maxYaw)
  172.                         {
  173.                                 mFireTime = time + Random.value * reactionTime;
  174.                                 mFiringDir = dir;
  175.                                 mFiringPitch = Mathf.Clamp01(distance / mMaxRange) * maxPitch;
  176.                         }
  177.                 }
  178.         }
  179. }

9
TNet 3 Support / Re: Tnet + Standart Ship Kit Help Me
« on: February 12, 2016, 08:51:48 PM »
Im having problem in canonball throw between clients the cannon script create the cannonball item with script

GameObject go = Instantiate(cannonballPrefab, mTrans.position, mTrans.rotation) as GameObject;

in this way the cannonball an be create in 1 client when im try to shoot i changed the script in

GameObject go = TNManager.Instantiate(cannonballPrefab, mTrans.position, mTrans.rotation) as GameObject;

and i addet object id in prefab but still the cannonballs wont be create in other client and give me the unique id error.
and [TNet] Trying to exute RFC #255 on TNObject #8 before it has been created

10
TNet 3 Support / Tnet + Standart Ship Kit Help Me
« on: February 12, 2016, 04:07:51 AM »
Hello All..
I have Tnet pacage and Standart Ship kit pacage..
im trying to make a multiplayer game with them but
im taking problem in cannonballs and heal between clients can you help me with that
please ....

Pages: [1]