/// <summary> /// Use this for initialization /// </summary> public void Start() { base.Start (); // set attackTime nextAttackTime = Time.time + attackSpeed; // set Tower and UID tower = GameObject.Find (towerUID); uid = towerUID + "." + GetComponent<NetworkIdentity> ().netId.ToString (); transform.name = uid; //get animator slAnim = GetComponent<SlimeAnim> (); // Keep them from jumping to 0,0,0 syncDestination = transform.position; syncPos = transform.position; syncRot = transform.rotation; // The Object steps out of the tower if (Vector3.Equals (stepOut, Vector3.zero)) { if (tower.transform.position.z < 0) { stepOut = Vector3.forward * 100; } else { stepOut = Vector3.back * 100; } } if (isServer) { // Make the object move out of the tower MoveTo (transform.position + stepOut); //Init selector on clients Rpc_initSelector (); Rpc_TriggerCloseDoors (); } }
// Use this for initialization void Start() { // Get tower, id and position/rotation tower = GameObject.Find (towerName); uid = towerName + "." + GetComponent<NetworkIdentity> ().netId.ToString (); transform.name = uid; syncPos = transform.position; syncRot = transform.rotation; currentHealth = maxHealth; if (isClient) { GetComponent<NetworkAnimator> ().SetParameterAutoSend (0, true); GetComponent<NetworkAnimator> ().SetParameterAutoSend (1, true); } if (isServer) { Debug.Log ("Spawning " + name + " of tower " + towerName + " at " + transform.position); // Get Animation Component, not needed on clients anim = GetComponent<Animator>(); slimeAnim = GetComponent<SlimeAnim>(); GetComponent<NetworkAnimator> ().SetParameterAutoSend (0, true); GetComponent<NetworkAnimator> ().SetParameterAutoSend (1, true); // Setup Health nextTime = Time.time + attackSpeed; // Make them step out if (Vector3.Equals (stepOut, Vector3.zero)) { if (tower.transform.position.z < 0) { stepOut = Vector3.forward * 15; } else { stepOut = Vector3.back * 15; } } } // Send command to server through Local Player in Tower // tower.GetComponent<Tower>().moveSoldier(name,transform.position + stepOut); }
// Use this for initialization void Start() { // Set up unique ID, current Healthpoints and the attack speed currentHealth = maxHealth; nextTime = Time.time + attackSpeed; uid = towerName + "." + GetComponent<NetworkIdentity> ().netId.ToString (); transform.name = uid; //offset.y = .785f; slAnim = GetComponent<SlimeAnim> (); // Keep them from jumping to 0,0,0 syncDestination = transform.position; // My commanding tower tower = GameObject.Find (towerName); tower.GetComponent<TowerAnim> ().openDoors(); // The Object steps out of the tower if (Vector3.Equals(stepOut,Vector3.zero)) { if (tower.transform.position.z < 0) { stepOut = Vector3.forward * 100; } else { stepOut = Vector3.back * 100; } } base.Start (); syncPos = transform.position; syncRot = transform.rotation; // Make the object move out of the tower MoveTo (transform.position + stepOut); }