public static void spawnObject(e_Objects obj, Vector3 position) { GameObject o = Instantiate(Tools.loadObjectFromResources(obj)); o.transform.position = position; NetworkServer.Spawn(o); }
public static GameObject getGameObjectFromObject(e_Objects id) { string path = paths[id]; if (path != null) { return((GameObject)Resources.Load(paths[id])); } string error = "Could not find specified Object in paths Dictionary (Assets/Scripts/Game.cs)"; Debug.LogError(error); return(null); }
public void damageEnemy(GameObject enemy, e_Objects impactEffect, e_DamageType type, float damageMultiplier) { DamageInfo damageInfo = new DamageInfo(); damageInfo.clientNetworkInstanceId = this.GetComponent <NetworkIdentity>().netId; damageInfo.enemyNetworkInstanceId = enemy.GetComponent <NetworkIdentity>().netId; damageInfo.damageType = type; damageInfo.damageTarget = e_DamageTarget.MOB; damageInfo.damageMultiplier = damageMultiplier; Vector3 pos = new Vector3(enemy.transform.position.x, enemy.transform.position.y + 0.5f, enemy.transform.position.z); GameObject o = Instantiate(ResourceStructure.getGameObjectFromObject(impactEffect)); o.transform.position = pos; o.transform.localScale = new Vector3(enemy.transform.lossyScale.x * 2, enemy.transform.lossyScale.y * 2, enemy.transform.lossyScale.z * 2); player.CmdSpawnGameObjectLocally(ResourceStructure.getPathForObject(impactEffect), pos); con.Send(PacketTypes.DEAL_DAMAGE, damageInfo); }
public static GameObject loadObjectFromResources(e_Objects obj) { return((GameObject)Resources.Load(ResourceStructure.getPathForObject(obj))); }
//#END OF DEPRICATED //#NEW SPAWN METHODS public static void spawnObject(e_Objects obj) { NetworkServer.Spawn(Instantiate(Tools.loadObjectFromResources(obj))); }
public void startRespawnTimer(e_Objects o, float time) { Debug.Log("Respawning enemy..."); objectsQueue.Add(o); timerQueue.Add(time); }
public static string getPathForObject(e_Objects id) { return(paths[id]); }
public static string getPathForObject(e_Objects id) { Debug.Log("ID: " + paths[id]); return(paths[id]); }