Пример #1
0
    public static void spawnObject(e_Objects obj, Vector3 position)
    {
        GameObject o = Instantiate(Tools.loadObjectFromResources(obj));

        o.transform.position = position;
        NetworkServer.Spawn(o);
    }
Пример #2
0
    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);
    }
Пример #3
0
    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);
    }
Пример #4
0
 public static GameObject loadObjectFromResources(e_Objects obj)
 {
     return((GameObject)Resources.Load(ResourceStructure.getPathForObject(obj)));
 }
Пример #5
0
    //#END OF DEPRICATED


    //#NEW SPAWN METHODS
    public static void spawnObject(e_Objects obj)
    {
        NetworkServer.Spawn(Instantiate(Tools.loadObjectFromResources(obj)));
    }
Пример #6
0
 public void startRespawnTimer(e_Objects o, float time)
 {
     Debug.Log("Respawning enemy...");
     objectsQueue.Add(o);
     timerQueue.Add(time);
 }
Пример #7
0
 public static string getPathForObject(e_Objects id)
 {
     return(paths[id]);
 }
Пример #8
0
 public static string getPathForObject(e_Objects id)
 {
     Debug.Log("ID: " + paths[id]);
     return(paths[id]);
 }