Exemple #1
0
 private static int Init(UBattleCollider uCollider, Transform transParent, int unitId, float posX, float posY, float zFactor, int direction, float logicPosition, UBattleUnit uOwnerUnit, float pendingTime)
 {
     uCollider = LUBattleUnit.Init(uCollider, unitId, false);
     if (uCollider == null)
     {
         return(0);
     }
     uCollider.transform.SetParent(transParent, false);
     uCollider.SetPosition(posX, posY, zFactor, direction, logicPosition);
     if (!uCollider.FireMissile(uOwnerUnit, pendingTime))
     {
         uCollider.Begin();
     }
     return(unitId);
 }
Exemple #2
0
    public static int Create(int unitId, int prefabNameId, int prefabFolderId, int objParentId)
    {
        var objParent = ObjectCache.GetComponent <CacheObject>(objParentId);

        if (objParent == null)
        {
            return(0);
        }
        var prefabName   = GameStrings.Get(prefabNameId);
        var prefabFolder = GameStrings.Get(prefabFolderId);
        var uMonster     = GameObjectPool.INSTANCE.RequestComponent <UBattleMonster>(prefabName, prefabFolder, true, objParent.transform);

        uMonster = LUBattleUnit.Init(uMonster, unitId);
        if (uMonster == null)
        {
            return(0);
        }
        return(unitId);
    }
Exemple #3
0
    public UBattleTower BindTower(string prefabName, string prefabFolder, bool forceBind)
    {
        if (tower != null)
        {
            if (!forceBind)
            {
                return(tower);
            }
            else
            {
                UnBindTower();
            }
        }

        var uTower = GameObjectPool.INSTANCE.RequestComponent <UBattleTower>(prefabName, prefabFolder, true);

        uTower = LUBattleUnit.Init(uTower, 0);
        if (uTower == null)
        {
            return(null);
        }
        BindTower(uTower);
        return(uTower);
    }